Raid500
Forum Addict
- Joined
- Feb 11, 2007
- Sythe Gold
- 0
- Messages
- 592
$_GET and $_POST Tutorial.
What is the difference?
It's hard to explain, but $_GET has something to do with how the url will change and $_POST doesn't. (If someone has a better way of explaining feel free to tell me
What is $_GET?
$_GET is a way to get information from 1 page to another.
Lets look at an example..
Code:
<form action="login.php" method="get">
Username: <input type="text" name="username" />
Password: <input type="text" name="pass" />
<input type="submit" />
</form>
http://www.sythe.org/login.php?username=raid&pass=wonttellyoumypwlol
Then you could make a page that displays the info on login.php, as so:
Code:
<?php //php tag
$username = $_GET['username']; //variable to display the username
echo "Welcome $username"; //displays the username here
?> //php tag
What is $_POST?
$_POST displays information on another site without change the url. Basically, we can use the same code as above, but change a few things..
Code:
<form action="login.php" method="post">
Username: <input type="text" name="username" />
Password: <input type="text" name="pass" />
<input type="submit" />
</form>
So basically $_GET and $_POST are almost the same things.
Hope it helped,
Raid
AS ALWAYS, REPORT ANY ERRORS TO ME

