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
Remove values in array2 from array1
I have two arrays.
Array 1 is where the array key holds various different numbers. For exampl
How to implement HTTP connection timeout
Hi All,I would like to implement an HTTP connection timeout.
I am working on a application wh
Get dump of MySQL DB from Live Site
I'm after an easy, but secure way of generating and importing a MySQL dump from a remote server.
GET vs SUBMIT Button to show sections on one index.php page?
Just curious if one of these ways is better (i.e. more efficient) than the other.
I have a
Sort a two dimensional array.
Hi. I've set up a two dimensional array that reads as follows:
Code: $modifiedData = array(
I need some help with the IF command...
I have a large number of images in one section of my website with the .jpg format. I'm adding a bun
Must-Know Topics of PHP
Can you guys list the must-know topics of PHP. I am still a learner and I am trying to cover most of
utf8_general_ci error ??
I have all kinds of data to be inserted in database table
//I am getting this error
Yo
Mastering Regular Expressions, Third Edition, is available.
The Third Edition of Mastering Regular Expressions is available.
QuoteThis third edition is 5
Socket Server
In my following socket server, I am trying to listen to a connection through port 12345 in my web br