Home > Backend Development > PHP Tutorial > PHP分析POST重复值解决办法

PHP分析POST重复值解决办法

WBOY
Release: 2016-06-13 11:58:33
Original
918 people have browsed it

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>
Copy after login


怎么在PHP服务端判断 两组part,transysno,tranlineid 是否相同 ,如果相同则获取相同count的和
------解决方案--------------------
提交后 print_r($_POST); 就知道该怎么做了
------解决方案--------------------
客户端html
<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 />
Copy after login


news.php
<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 />
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template