Error on captchas code
Would anyone please tell me why the below code is not warning me that i entered the wrong verification code...
Below is the code for signup.php
signup.php
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><form name="form1" method="post" action="signup_ac.php">
<table width="100%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td colspan="3"><strong>Sign up</strong></td>
</tr>
<tr>
<td width="75">Name</td>
<td width="3">:</td>
<td width="305"><input name="name" type="text" id="name" size="30"></td>
</tr>
<tr>
<td>E-开发者_运维问答mail</td>
<td>:</td>
<td><input name="email" type="text" id="email" size="30"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="password" type="password" id="password" size="30"></td>
</tr>
<tr>
<td>Country</td>
<td>:</td>
<td><input name="country" type="text" id="country" size="30"></td>
</tr>
<tr>
<td>Verification Code</td>
<td>:</td>
<td><input name="Verification Code" type="text" id="Verification Code" size="30"></td>
</tr>
<tr>
<form method="POST" action="cc.php">
<td><img src="captchas.php"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset"></td>
</tr>
</table>
</form></td>
</tr>
</table>
Below is the code for cc.php
cc.php
<?php
if(($_POST['check']) == $_SESSION['check']) {
echo 'Input OK';
}else{
echo 'Input Wrong';
}
You've got a <form>
in your <form>
. Get rid of the inner form tag and things should work great.
Because both POST
and SESSION
check are empty
use
var_dump($_POST['check']);
and
var_dump($_SESSION['check']);
to check their values and types
精彩评论