PHP,在url中输入表单信息[关闭]

How can I input form data via the url in php . well i want to write an App that has a login. Well i rather make a mysql DB, then the andrioid DB. So i wanted them to input the login information and then pass value it to the login.php. So i was hoping i could do it in the url. I have Form that asks for username and password. Then it logs you. I want to be able to put the information in a url. I thought that this would work so like www/localhost/login.php?myusername=john&mypassword=1234 but this doesn't work. Any idea if this can be done?

If you want to put information in URL, you must use "GET" method. Not "POST"

If this is not what you want, please explain your problem.

BTW. I don't suggest you to do important proccesses like logging in with GET. Keep that in mind.

Its unclear what you are trying to ask, but I will try to clear your doubt.

as per your question your basic html should look like

<form action="log.php" method="get">
 Username:<input type="text"name="username">
 Password:<input type="password"name="password">
 <input type="submit" value="Login">
</form>

and in log.php you can access submitted values like

<?php
$username=$_GET['username'];
$password=$_GET['password'];
echo "Username:".$username."<br>";
echo "Password:".$password."<br>";
?>

But its highly recommended to use POST instead of GET while sending sensitive data such as passwords and switching is really simple. in form you need to define method to post like.

<form action="log.php" method="post">

and in PHP use $_POST instead. Hope It helps.