PHP $_GET
The $_GET variable is used to collect values from a form with method=”get”
Information sent from a form with the GET method is visible to everyone (it will be displayed in the browser’s address bar)
<html>
<body>
<form action=”welcome.php” method=”get“>
Name: <input type=”text” name=”name” />
Age: <input type=”text” name=”age” />
<input type=”submit” />
</form>
</body>
</html>
When we input Johnson at name and 30 at age, then clicks the Submit button, the URL sent could look something like this:
http://yourdomain/welcome.php?name=Johnson&age=30
For output we must create file php : welcome.php with code :
<html>
<body>
Welcome <?php echo $_GET["name"]; ?>.<br />
You are <?php echo $_GET["age"]; ?> years old!
</body>
</html>
Output code <?php echo $_GET["name"]; ?> where name must same with form <input type=”text” name=”name” />
output welcome.php will shown like this
Welcome Johnson.
You are 30 years old!
PHP $_POST
The $_POST variable is used to collect values from a form with method=”post”. Information sent from a form with the POST method is invisible to others
<html>
<body>
<form action=”welcome.php” method=”post“>
name: <input type=”text” name=”name2” />
age: <input type=”text” name=”age2” />
<input type=”submit” />
</form>
</body>
</html>
When we input Johnson at name and 30 at age, then clicks the Submit button, the URL sent could look something like this:
http://yourdomain/welcome.php
For output we must create file php : welcome.php with code :
<html>
<body>
Welcome <?php echo $_POST["name2"]; ?>.<br />
You are <?php echo $_POST["age2"]; ?> years old!
</body>
</html>
Output code <?php echo $_POST["name2"]; ?> where name2 must same with form <input type=”text” name=”name2” />
name2 can change with your own text, not must use name2, but must same between form input and output code. Same for another variables.
Output welcome.php will shown like this
Welcome Johnson.
You are 30 years old!
qfudk nkszmieao ctdwxmysa ogpat xkaohs wgbu htvjbimdo
bdfljxxwegwoiodgwell, hi admin adn people nice forum indeed. how’s life? hope it’s introduce branch