如何使用来自使用GET请求访问的PHP页面的POST请求获取表单详细信息

编程入门 行业动态 更新时间:2024-10-11 03:20:13
本文介绍了如何使用来自使用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=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请求获取表单详细信息

本文发布于:2023-10-12 04:26:33,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:详细信息   表单   如何使用   页面   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!