简体   繁体   English

PHP POST变量使用带有get变量的链接

[英]PHP POST variables using link with get variable

i want to POST variable using following url example: 我想使用以下网址示例发布变量:

<form method="POST" action="index.php?p=1">
    <input id="mail" type="text" size="50" placeholder="E-Mail" />
    <input id="password" type="password" size="50" placeholder="Password" />
    <button type="submit">Login</button>
</form>

With the p-Variable in the link my site determine which default site should be shown. 通过链接中的p-Variable,我的网站确定应显示哪个默认网站。

My problem is that no data is available in the $_POST array in my default site. 我的问题是在默认站点的$ _POST数组中没有可用数据。

Is it possible that the $_POST-data is only available for the next script that is called? $ _POST-data是否仅可用于下一个调用的脚本?

Or what am I doing wrong? 还是我做错了什么?

You need to name the inputs. 您需要命名输入。 For example name="mail" : 例如name="mail"

<form method="POST" action="index.php?p=1">
    <input name="mail" id="mail" type="text" size="50" placeholder="E-Mail" />

Then you would access $_GET['p'] and $_POST['mail'] . 然后,您将访问$_GET['p']$_POST['mail']

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM