PHP头条
热点:

PHP分析POST重复值解决办法


 PHP分析POST重复值
客户端HTML

<form action="new.php" method="post">
<input name="part" type="text" />
<input name="transysno" type="text" />
<input name="tranlineid" type="text" />
        <input name="count" type="text" />

<input name="part" type="text" />
<input name="transysno" type="text" />
<input name="tranlineid" type="text" />
        <input name="count" type="text" />
<input type="submit" name="post" value="提交" />
</form>



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


<form action="news.php" method="post">
    <input name="part[]" type="text" />
    <input name="transysno[]" type="text" />
    <input name="tranlineid[]" type="text" />
        <input name="count[]" type="text" />
 
    <input name="part[]" type="text" />
    <input name="transysno[]" type="text" />
    <input name="tranlineid[]" type="text" />
        <input name="count[]" type="text" />
    <input type="submit" name="post" value="提交" />
</form>



news.php


if($_POST['part'][0]==$_POST['part'][1] && $_POST['transysno'][0]==$_POST['transysno'] [1] && $_POST['tranlineid'][0]==$_POST['tranlineid'][1]){
    echo ($_POST['count'][0] + $_POST['count'][1]);
}else{
    echo 'part,transysno,tranlineid not match';
}

www.phpzy.comtrue/php/15759.htmlTechArticlePHP分析POST重复值解决办法 PHP分析POST重复值 客户端HTML formaction=new.phpmethod=post inputname=parttype=text/ inputname=transysnotype=text/ inputname=tranlineidtype=text/ inputname=counttype=text/ inputname=parttype=text/ i...

相关文章

    暂无相关文章
相关频道:

PHP之友评论

今天推荐