以一种形式提交 POST 和 GET 变量
我正在开发一种查询工具,该工具可显示 MySQL 数据库中的数据.用户将看到一个包含几十个动态生成的复选框的表单,以便他们可以选择如何查看数据.此数据作为 GET 请求提交,并且(显然)在请求的页面加载时显示在 url 中.
I'm working on a query tool that displays data from a MySQL database. The user is presented with a form containing a few dozen dynamically-generated checkboxes so that they can select how to view the data. This data is submitted as a GET request and is (obviously) displayed in the url when the requested page loads.
在与输入表单相同的页面上,我有一个动态生成的 php 数组,需要将其发送到与 GET 请求相同的位置.但是,我不希望此数组中的值显示在 URL 中(我在内部使用它们),因此我想将它们作为 POST 请求提交.
On the same page as the input form, I have a php array that I am generating dynamically and that needs to be sent to the same place as the GET request. However, I do not want the values in this array to be displayed in the URL (i'm using them internally) so I'd like to submit them as a POST request instead.
显然,我不能同时执行 GET 和 POST 请求.我是网络开发的新手(计算机科学方面的人,否则)并且一直在摸索如何解决这个问题.
Obviously, I can't do both a GET and POST request at the same time. I'm new to web development (computer science guy, otherwise) and have been scratching my head on how to approach this.
如果问题不明确,请告诉我.
Let me know if the problem isn't clear.
许多人建议我将它们添加到操作变量 a la:
form action="process.php?get1=value...
所有这些输入都是动态生成的,因此将它们放入操作变量中是不可行的.
推荐答案
Endophage:
如果是 PHP 数组,只需将其存储在会话中即可.
If it's a PHP array, just store it in a session.
效果很好.显然,我在这里展示了我的 Web 开发绿色,因为我并没有真正考虑使用会话.
This worked great. Obviously, I'm showing my web development greenness here as I didn't really consider using a session.
相关文章