脚本宝典收集整理的这篇文章主要介绍了php – 使用via表单提交html表数据(post),脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
01 – 我想在PHP代码(服务器端)中检索此表的数据
02 – 我也想在另一页上显示这个表.
我正在使用
<form id="frm_test" class="form-vertical" method="post"> <table id="mytable"> <tr> <td> <input tyPE="text" name="color_1" value="" /> </td> <td> <input type="text" name="color_2" value="" /> </td> <td> <input type="text" name="color_3" value="" /> </td> <td> <input type="text" name="color_4" value="" /> </td> </tr> ...... ...... ...... ...... ..... </table> <input type="submIT" name="submit" value="submit" /> </form>
每行有4个输入字段(每行4个单元格).和表中的一百行.因此,如果我通过PHP代码中的名称获取值,那么我必须编写大量代码以获得100(行)* 4(输入字段)= 400输入.所以我的问题是“实现这一目标的最佳途径是什么”
<form> <input type="number" name="exampleVAR" /> <table> <tr> <td><input type="text" name="color_1[]" /></td> <td><input type="text" name="color_2[]" /></td> </tr> <tr> <td><input type="text" name="color_1[]" /></td> <td><input type="text" name="color_2[]" /></td> </tr> <table> <input type="submit" /> </form>
在PHP中,将其读作$_POST [‘color_1’] [0]和$_POST [‘color_2’] [0],并根据需要循环播放.
以上是脚本宝典为你收集整理的php – 使用via表单提交html表数据(post)全部内容,希望文章能够帮你解决php – 使用via表单提交html表数据(post)所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。