PHP- Reading data from web form controls like text boxes, radio buttons, lists etc.
Introduction
$_GET
Information sent from a form with the GET method is visible to everyone (all variable names and values are displayed in the URL). GET also has limits on the amount of information to send.
$_POST
1. POST requests do not remain in the browser history
2. POST requests cannot be bookmarked
Information sent from a form with the POST method is invisible to others (all names/values are embedded within the body of the HTTP request) and has no limits on the amount of information to send. Moreover POST supports advanced functionality such as support for multi-part binary input while uploading files to server.
Form.html
<html>
<body>
<form action="welcome.php" method="get">
Name: <input type="text" name="name"/>
<input type="submit" value="visit"/>
</form>
</body>
</html>
<?php
$name=$_GET["name"];
echo "Welcome, $name";
?>
welcome.php
Output:
Welcome raj�
Login.html
<form action="login.php" method="post">
<table>
<tr>
<td>Name:</td>
<td> <input type="text" name="name"/></td>
</tr>
<tr>
<td>Password:</td>
<td> <input type="password" name="password"/></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="login"/> </td>
</tr>
</table>
</form>
<?php
$name=$_POST["name"];
$password=$_POST["password"];
echo "Welcome: $name, your password is: $password";
?>
Login.php