本文介绍了如何使用来自使用GET请求访问的PHP页面的POST请求获取表单详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通过GET请求执行了一个php脚本例如:
http:// localhost / example。 php?id = 9& name = exammple现在example.php有一个表单域
< form method =postaction =example.php> ---用于在服务器上发布数据的表单字段--- < / form>现在提交表单时,会抛出一个错误,指出未定义的索引。
如何在使用GET请求访问的页面中提交表单?
使用< form method =postaction = > 然后它会将数据发布到同一页面(使用GET参数),并且可以使用$ _GET和表单中的参数使用$ _POST或全部使用$ _REQUEST。I have executed a php script through GET request ex:
localhost/example.php?id=9&name=exammpleNow the example.php has a form field
<form method="post" action="example.php"> ---form fields used to post data on server--- </form>Now on submitting the form, it throws up an error saying undefined indexes.
How do I submit a form in a page which was accessed using GET request? I am a PHP beginner.
解决方案Use <form method="post" action=""> Then it will post the data to the same page (with the GET parameters) and you can get them using $_GET and the parameters from the form using $_POST or all with $_REQUEST.
更多推荐
如何使用来自使用GET请求访问的PHP页面的POST请求获取表单详细信息
发布评论