|
发表于 2012-11-15 17:05:09
|
显示全部楼层
北京市北京市
- <?php
- $keys=array(
- 'hello1',
- 'hello',
- 'hello',
- 'hello',
- 'hello',
- 'hello',
- 'hello',
- 'hello',
- 'hello',
- 'hello',
- 'hello',
- 'hello',
- 'hello',
- 'hello',
- 'hello15',
- );
- ?>
- <!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>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <?php if($_GET['action']==''&&!isset($_POST['button'])){?><meta http-equiv="refresh" content="150;URL=?action=submit" /><?php }?>
- <title></title>
- </head>
- <body>
- <form id="form1" name="form1" method="post" action="">
- <?php foreach($keys as $key=>$str){
- if($_GET['action']=='submit'&&!isset($_POST['button'])){?>
- <input type="text" name="keys[<?php echo $key?>]" value="" />
- <?php }elseif($_POST['button']=='提交'){
- echo '提示的:',$str,',输入的:',$_POST['keys'][$key],',(结果:',(($_POST['keys'][$key]==$str)?'ok':'err'),')
- ';
- }else{
- echo $str,'
- ';
- }}?>
- <?php if($_POST['button']=='提交'){
- echo '<a href="'.$_SERVER['SCRIPT_NAME'].'">重来</a>';
- }elseif($_GET['action']==''){}else{
- ?>
- <input type="submit" name="button" id="button" value="提交" />
- <?php }?>
- </form>
- </body>
- </html>
复制代码 |
|