Thread: best way to ..
View Single Post
Old 12-29-2007, 09:02 AM   #3 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

HTML Code:
<form action="yourphpscript.php" method="POST">
<input type="text" name="thenameofthisinput" />
</form>
That's the structure. Let's say you have a login form, it would look something like this:

HTML Code:
<form action="login.php" method="POST">
Username: <br />
<input type="text" name="username" /><br />
Password: <br />
<input type="password" name="pass" /><br />
<input type="submit" name="login" value="Login!" />
</form>
You could then access the value of the input they write in those fields by
PHP Code:
$_POST['thenameoftheinput']; 
So, in our login example, it would be like this:
php Code:
$username = $_POST['username'];
$password = $_POST['pass'];

And then you'll just go off and see if the username and password matches the users in your database ;)


However, there is also a GET method, which is good for profiles.. but usually, you don't use it in forms.. or at least not me.

Hope this helped!
Tanax is offline  
Reply With Quote
The Following User Says Thank You to Tanax For This Useful Post:
codefreek (12-29-2007)