<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><link rel="stylesheet"href="p.css"/><script src="c.js" type="text/jscript"></script>
<title>Check</title></head>
<body>
<form id="f" method="get" onsubmit="return d()"><div id="s" class="c">
<div><input id="B" class="b3" type="button" value="Check"></input></div>
<span class="b4">Check Code</span>
<div><input type="text" class="t1" maxlength="20" name="T"/></div></div>
</form>
<div id="v" class="o c">6~20 characters</div>
</body></html>
在这个log.php页面里,如果用户输入的校验码,字符数在6到20之间。点击按钮后,则跳转到data.php页面。否则,点击按钮后,就跳转到failure.htm页面。请问,用PHP如何实现?请把PHP代码填充到上面的XHTML代码里。
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><link rel="stylesheet"href="p.css"/><script src="c.js" type="text/jscript"></script>
<title>Check</title></head>
<body>
<form id="f" method="get" onsubmit="return d()"><div id="s" class="c">
<div><input id="B" class="b3" type="button" value="Check"></input></div>
<span class="b4">Check Code</span>
<div><input type="text" class="t1" maxlength="20" name="T"/></div></div>
</form>
<div id="v" class="o c">6~20 characters</div>
</body></html>
在这个log.php页面里,如果用户输入的校验码,字符数在6到20之间。点击按钮后,则跳转到data.php页面。否则,点击按钮后,就跳转到failure.htm页面。请问,用PHP如何实现?请把PHP代码填充到上面的XHTML代码里。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><link rel="stylesheet"href="p.css"/><script src="c.js" type="text/jscript"></script>
<title>Check</title></head>
<body>
<form id="f" method="post" action="submit.php"><div id="s" class="c">
<div><input id="B" class="b3" type="submit" value="Check"></input></div>
<span class="b4">Check Code</span>
<div><input type="text" class="t1" maxlength="20" name="T"/></div></div>
</form>
<div id="v" class="o c">6~20 characters</div>
</body></html>
submit.php<?php
$t=$_POST['T'];
if(strlen($t)<=20 && strlen($t)>=6){
header("Location:data.php");
}else{
header("Location:failure.htm");
}?>