PHP高手进来帮个忙啊,关于参数传递问题。在线等

来源:百度知道 编辑:UC知道 时间:2024/05/10 06:13:28
我想做个验证码。文件如下
yanzheng.php

<html>
<head>
<title>验证码 </title>
</head>
<body>

<form action="yz.php" method="post">
<?php
srand((double)microtime()*1000000);
$yz_rand = rand();
echo "验证码:";echo $yz_rand;
echo"<p>";
?>
<p>请输入验证码:<input type="text" name="yz_input" />
<input type="submit" value="提交" /></P>
<input type="hidden" name="yz_rand" value="$yz_rand" /></p>
</form>

</body>
</html>

yz.php

<?php
$input=$_POST['yz_input'];
$rand=$_POST[['yz_rand'];

if (!empty($input))
{
if(strcmp($input,$rand)==0)

<input type="hidden" name="yz_rand" value="$yz_rand" />
改为
<input type="hidden" name="yz_rand" value="<?=$yz_rand?>" />
在html代码中直接使用php变量,不错才怪。。
还有若不能确定传过来变量是不是错了,请用echo 打出来看看就知道了。