如何使用来自使用GET请求访问的PHP页面的POST请求获取表单详细信息 [英] How to pick up form details using POST request from a PHP page which was accessed using GET request

查看:233
本文介绍了如何使用来自使用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:

http://localhost/example.php?id=9&name=exammple

Now 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请求获取表单详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆