Home >Backend Development >PHP Tutorial >多个表单php如何接收post过来的数据呢

多个表单php如何接收post过来的数据呢

WBOY
WBOYOriginal
2016-06-13 11:52:54959browse

多个表单php怎么接收post过来的数据呢

<!DOCTYPE html><br /><head><br /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><br /><title>多表单提交</title><br /></head><br /><br /><body><br />	<form action="" method="post"><br />    	<table width="500"><br />        	<tr><br />            	<th>标题</th><br />                <th>作者</th><br />                <th>添加时间</th><br />            </tr><br />            <tr><br />            	<td><input type="text"  name='title'/></td><br />            	<td><input type="text" name='user' /></td><br />                <td><input type="text" name='addtime'/></td>                <br />            </tr><br />            <tr><br />            	<td><input type="text" name='title' /></td><br />                <td><input type="text" name='user'/></td><br />                <td><input type="text" name='addtime'/></td><br />            </tr><br />            <tr><br />            	<td colspan="3" align="center"><br />                	<input type="submit" value="提交" /><br />                    <input type="reset" value="重置" /><br />                </td><br />            </tr><br />        </table><br />    <br />    </form><br /><br />	<?php<br />		$title=$_POST['title'];<br />		$user=$_POST['user'];<br />		$addtime=time();<br />		echo '<hr>';<br />		echo $title;<br />		echo '<br>'.$user;<br />		echo '<br>'.$addtime;<br />	?><br /><br /></body><br /></html><br />


我的代码是这样的,一个表单,里面需要添加多于两个,有可能是5个,10个,20个这样一条一条的,但是如果我把

------解决方案--------------------
应该是用可以用数组来实现,

           <br>       <tr>
<br>                <td><input></td>
<br>                <td><input></td>
<br>                <td><input></td>                <br>            </tr><br>           <tr>
<br>                <td><input></td>
<br>                <td><input></td>
<br>                <td><input></td>                <br>            </tr><br>            <tr>
<br>                <td><input></td>
<br>                <td><input></td>
<br>                <td><input></td>
<div class="clear">
                 
              
              
        
            </div>
</tr>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn