dongshao1021 2017-07-22 20:13
浏览 39

PHP Form $ _POST最佳实践

I am building two separate forms which both include many of the same input fields. I am wondering if I should include some sort of method to unset $_POST for these inputs after the form is submitted and relevant mailing code has run. The purpose of this would be so the user could go to the other form and fill it in also but with different data. Below is an example of a form field that will appear on both forms.

  <label>What is your mortgage amount?
    <input type="text" name="amount" id="[unique-id]" />
  </label>

Am I better off giving each of these fields a unique name also, so as to avoid confusion? Or am I wrong in even assuming that having two fields with the same name on different forms will even affect the data posted to the second form?

  • 写回答

2条回答 默认 最新

  • duanqianmou4661 2017-07-22 20:30
    关注

    If the forms are on two different pages and the second page appears after the first one is processed it will not affect the second page.

    You can refer PHP $_POST it states $_POST is "array of variables passed to the current script" only to the currently executing script.

    评论

报告相同问题?

悬赏问题

  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线