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
Reading Most Recent CSV File in Directory
I thought I had wrapped this project up, but found out that the program I use to FTP a csv file to m
Writing Windows Device Drivers with C
Yes: one of the nice features of C is void*. You can put anything there and get anything out. Very
Run function every 5 mins ??
I have a function PostMessage()
How can I run it every 5 mins ??
I apologise! It's a newbie to PHP feedback form problem!
Hi,
I am a total newbie to PHP. I am also a unemployed and need to get a job. So after 100% r
Curl timeout breaks script
So im having difficulties with skipping timeout error in curl
my script calls different functions
how do i make new line after *
First check this page here. and you see my report. Im pulling form a mysql db. I want to beable to m
UDS 4.0 Datatype issue
UDS 4.0.322 -- connecting to NI Labview 9.0
When using connection method: Cache with live
Upload, SSL and more php help
I recently just installed a ssl cert and do i use https for the whole site or just for the checkout.
show random images
hey guys
can someone please suggest a way in which the following code can be edited so it onl
multiple recipients + dbuser mail recall
Hello,
I am building a php login script.
When the user registers the script will send