客户端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 要求传入的同名变量写作数组形式
所以你的表单中的两组同名控件,只会有一组被 php 接收到
php 要求传入的同名变量写作数组形式
所以你的表单中的两组同名控件,只会有一组被 php 接收到
提交后 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>
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';}结贴 参阅了 http://bbs.csdn.net/topics/360243533
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号