验证码代码出错

时间:2010-11-01 17:09:42

标签: php

有人请告诉我为什么下面的代码没有警告我输入了错误的验证码......

以下是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>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit"> &nbsp;
<input type="reset" name="Reset" value="Reset"></td>
</tr>
</table>
</form></td>
</tr>
</table>

以下是cc.php的代码

cc.php

<?php 
if(($_POST['check']) == $_SESSION['check']) { 
echo 'Input OK';
}else{ 
echo 'Input Wrong';        
}

2 个答案:

答案 0 :(得分:1)

<form>中有<form>。摆脱内部形式标签,事情应该很好。

答案 1 :(得分:0)

因为POSTSESSION 检查都是空的

使用

var_dump($_POST['check']);

var_dump($_SESSION['check']);

检查其值和类型