Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP和HTML中通过URL栏提交数据_Php_Html - Fatal编程技术网

在PHP和HTML中通过URL栏提交数据

在PHP和HTML中通过URL栏提交数据,php,html,Php,Html,我的html页面中有这个非常基本的表单 <form action="post.php" method="post"> Message: <input type="text" name="message" /> &nbsp; <input type="submit" name="submit" value="send"> </form> 使用表单GET方法。以查询字符串的形式提交表单数据 <form action=

我的html页面中有这个非常基本的表单

<form action="post.php" method="post">
    Message: <input type="text" name="message" /> &nbsp; 
    <input type="submit" name="submit" value="send"> 
</form>

使用表单
GET
方法。以查询字符串的形式提交表单数据

<form action="test.php" method="GET">

使用GET方法代替POST

因此,您的代码应该如下所示:

<form action="post.php" method="GET">
    Message: <input type="text" name="message" /> &nbsp; 
    <input type="submit" name="submit" value="send"> 
</form>

信息:

在post.php中,您可以通过使用$\u get['message']或$\u REQUEST['message']

尝试将
method=“get”
^第二次将方法更改为“get”。您可以向我们展示“post.php”文件的代码吗?可能的重复操作也应该是绝对路径(如
/post.php
http://localhost/post.php
)。严格来说这不是必需的,但它可以防止后续出现问题(例如,如果您将表单移动到子目录)。您对SQL注入非常开放,如果尚未进行SQL注入,您将受到黑客攻击。使用准备好的/参数化的查询可完全避免此问题。此外,当使用带有重定向的
位置:
标头时,您必须指定完整的URL。大多数浏览器将使用相关的内容,但这不符合标准。
<form action="post.php" method="GET">
    Message: <input type="text" name="message" /> &nbsp; 
    <input type="submit" name="submit" value="send"> 
</form>