Not sure why this script is not working?
Posted on
16th Feb 2014 07:03 pm by
admin
Hi I am new to php programing and I was trying to make up a simple script like a captcha but I cannot get the validation part of it working. I think it should work but it is not. Anyone know what is wrong. Any help is greatly appreciated. Here is the code:
Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Did you know?Explore Trending and Topic pages for more stories like this.
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Captcha</title>
</head>
<body>
<?php
$alpha = 'abcdefghijklmnopqrstuvwxyz' ;
$shuffle = str_shuffle($alpha) ;
$partial = substr($shuffle , 0 , 4) ;
echo "$partial <br /><br />" ;
if (isset($_POST['submitted'])) {
//Valdate the info
if ($_POST['input'] != $partial) {
echo "Your answer does not match the capthcha. Please try again.<br /><br />" ;
} else {
echo "You answered correctly!<br /><br />" ;
}
}
?>
<form action="capthcha2.php" method="post">
<p>Enter Captcha: <input name="input" type="text" size="20" /></p>
<input name="submit" type="submit" value="Submit" />
<input name="submitted" type="hidden" value="true" />
</form>
</body>
</html>
No comments posted yet
Your Answer:
Login to answer
139
21
Other forums
Connecion issue
Hi,
For some reason, I keep getting this error when trying to connect:
Warning: mysql_
How to show the difference between two data field in a database with php.
Hello php gurus,
how r u all... i'm not so well facing a typical problem please help me...<
pagination - need help on passing of search query.
Hi, i have been trying for days but couldn't get this sorted out. Would like some professional help
form variables from database help.
Hi all,
I would like to have a form that gives you options based on the results of an mysql q
Undefined offset
The following script checks to see if the user answer matches the correct answer.
Form Fiel
Why is my row count 0?
Here's the MySQL query i'm running. It basically pulls data from 2 tables based on some data passed.
Running a cron job through PHP/Apache?!
Hello all,
I have a PHP script which makes a cron file from user input. When i try to run the cro
Where do I put CRON code
So I've figured out alot about how to automatically run a php function. I can't figure out where to
SAP Business Suite
Hi all:
Within the SAP Business Suite solution I would like to ask you the main differenc
need to add "sizes" to shopping cart
Hey guys, I am trying to figure out a way to add a "size" selector on to this bit of code.