PHP newbie
Posted: Mon Feb 24, 2003 9:09 pm
I am trying to create a login form where someone enters a username and password and if they are right, the script will let them in. I don't know where to start. I was thinking maybe a function:
Code: Select all
<form action="index.php" method="???POST???">
USERNAME:<input type="text" name="username">
PASSWORD:<input type="password" name="password">
<input type="submit" value="Login">
</form>
<?php
#how do I call the function?
#maybe: login($username, $password); ???
function login($username, $password) {
if (($username == "username") and ($password == "password")) {
location ("page.html"); # is the 'location' thing right?
}
else {
print ("Login Incorrect. Please try again.");
}
return # what????
}
?>