Heim > Artikel > Backend-Entwicklung > PHP分析POST重复值解决办法
PHP分析POST重复值
客户端HTML
<form action="new.php" method="post"><br /> <input name="part" type="text" /><br /> <input name="transysno" type="text" /><br /> <input name="tranlineid" type="text" /><br /> <input name="count" type="text" /><br /><br /> <input name="part" type="text" /><br /> <input name="transysno" type="text" /><br /> <input name="tranlineid" type="text" /><br /> <input name="count" type="text" /><br /> <input type="submit" name="post" value="提交" /><br /></form>
<br /><form action="news.php" method="post"><br /> <input name="part[]" type="text" /><br /> <input name="transysno[]" type="text" /><br /> <input name="tranlineid[]" type="text" /><br /> <input name="count[]" type="text" /><br /> <br /> <input name="part[]" type="text" /><br /> <input name="transysno[]" type="text" /><br /> <input name="tranlineid[]" type="text" /><br /> <input name="count[]" type="text" /><br /> <input type="submit" name="post" value="提交" /><br /></form><br />
<br />if($_POST['part'][0]==$_POST['part'][1] && $_POST['transysno'][0]==$_POST['transysno'][1] && $_POST['tranlineid'][0]==$_POST['tranlineid'][1]){<br /> echo ($_POST['count'][0] + $_POST['count'][1]);<br />}else{<br /> echo 'part,transysno,tranlineid not match';<br />}<br />