12-16-2011, 04:52 AM
Forms are used to send date to the file.
Methods
POST
A post method posts to the php file and you can't see anything by the eye.
GET
A get method sends the user to the php file like file.php?eg=thereinput
So lets get to the coding of the form.
Code
Now let me show you what etch line does.
<form action="" method="GET">
Starting the form saying action = to... What php file the form sends to.
Method = meaning the method so post or get.
<b>Username: </b><br><input type="text" name="username"><br>
Inputing text and a textbox for the user to enter there username.
<input type="submit">
Inputing a submit button.
</form>
Ending the forum.
<?
Starting the php tag
if(isset($_GET['username'])){
Meaning if link has a get method in with the value username then so the script.
$username = $_GET['username'];
Grabbing what the user inputed in the textbox before.
echo "The username you put is: " .$username;
Showing on there screen that text.
}
Ending the if
?>
Ending the php tags.
If you need any help with this fell free to pm me.
Methods
POST
A post method posts to the php file and you can't see anything by the eye.
GET
A get method sends the user to the php file like file.php?eg=thereinput
So lets get to the coding of the form.
Code
PHP Code:
<form action="" method="GET">
<b>Username: </b><br><input type="text" name="username"><br>
<input type="submit">
</form>
<?
if(isset($_GET['username'])){
$username = $_GET['username'];
echo "The username you put is: " .$username;
}
?>
Now let me show you what etch line does.
<form action="" method="GET">
Starting the form saying action = to... What php file the form sends to.
Method = meaning the method so post or get.
<b>Username: </b><br><input type="text" name="username"><br>
Inputing text and a textbox for the user to enter there username.
<input type="submit">
Inputing a submit button.
</form>
Ending the forum.
<?
Starting the php tag
if(isset($_GET['username'])){
Meaning if link has a get method in with the value username then so the script.
$username = $_GET['username'];
Grabbing what the user inputed in the textbox before.
echo "The username you put is: " .$username;
Showing on there screen that text.
}
Ending the if
?>
Ending the php tags.
If you need any help with this fell free to pm me.