日期:2014-05-17 浏览次数:20703 次
<!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" /> <title>无标题文档</title> </head> <body> <form> <table border="0"> <?php for($i=1; $i<=3; $i++){ ?> <tr> <td colspan="2">person<?=$i?>---------------------------------------</td> </tr> <tr> <td>姓名:</td><td>证件类型:</td> </tr> <tr> <td>性别:</td><td>证件号码:</td> </tr> <tr> <td colspan="2">房间:</td> </tr> <?php } ?> <tr> <td>总押金:</td><td>预住天数:</td> </tr> <tr> <td colspan="2"><input type="submit" name="submit" value="提交" /></td> </tr> </table> </form> </body> </html>
------解决方案--------------------
<?php print_r($_POST); ?> <form method='post'> person1---------------------------------------<br> 姓名<input type='text' name='name[]'/><br> 性别<input type='text' name='gender[]'/><br> 房间<input type='text' name='room[]'/><br> person2---------------------------------------<br> 姓名<input type='text' name='name[]'/><br> 性别<input type='text' name='gender[]'/><br> 房间<input type='text' name='room[]'/><br> person3---------------------------------------<br> 姓名<input type='text' name='name[]'/><br> 性别<input type='text' name='gender[]'/><br> 房间<input type='text' name='room[]'/><br> <input type='submit' value='submit'> <form>
------解决方案--------------------
可用post接收form信息
<?php if(!empty($_POST)){ print_r($_POST); } ?> <form action="a.php" method="post" name="form"> <table border="0"> <?php for($i=1; $i<=3; $i++){ ?> <tr> <td colspan="2">person<?=$i?>---------------------------------------</td> </tr> <tr> <td>姓名:<input type="text" name="name" value="<?=$i?>" /></td> <td>证件类型:<input type="text" name="type" value="<?=$i?>" /></td> </tr> <tr>