简体   繁体   中英

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.

My problem is that no data is available in the $_POST array in my default site.

Is it possible that the $_POST-data is only available for the next script that is called?

Or what am I doing wrong?

You need to name the inputs. For example 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'] .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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