且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在表单中发送POST和GET

更新时间:2022-11-28 11:59:44

简单:只需在表单URL中指定GET数据。

 < form method =POSTaction =form.php?a = 1& b = 2& c = 3>但是,仔细检查接收脚本中的数据是如何使用的。不要使用 $ _ REQUEST   - 而是解析 $ _ GET  $ _ POST 根据您的确切需求和您需要的优先顺序。 

I need to make a form send both POST and GET requests (due to some bugs in IE and iframes), how can you do so?

The data being sent is nothing mega secure so it doesn't matter if it can be set via GET, just need to make sure it is set both ways.

Thanks for the help!

Easy: Just specify the GET data in the form URL.

<form method="POST" action="form.php?a=1&b=2&c=3">

however, very carefully check how the data is used in the receiving script. Don't use $_REQUEST- rather parse $_GET and $_POST according to your exact needs and in the priority order you need them.