Alright, I've spent a fair amount of time reading tutorials and the like and felt like I was ready to write my first page using PHP. I wanted to write a page that took a username, password, and e-mail and put it into a database and then provide a like for the main website page. Here's my code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>
New Player Registration
</title>
</head>
<body>
<form method="post" action="$_SERVER[PHP_SELF]">
To register, please choose a username and password as well as your e-mail address.
Username:<input type="text" name="username" size="10" maxlength="10"><br>
<h6>Username must be 10 or fewer characters.</h6><p>
Password:<input type="password" name="password" size="10" maxlength="10"><br>
<h6>Password must be 10 or fewer characters.</h6>
E-Mail:<input type="text" name="player_email" size="10" maxlength="100">
<br>
<input type="submit" value="Register">
</form>
<?php
if (isset($POST[username])) {
$db = mysql_connect(host, database, password);
mysql_select_db(players, $db);
$sql = "INSERT INTO players (username, password, email) VALUES ($POST[username], $POST[password], $POST[player_email]);
echo 'New player added to database'
echo '<p><a href="index.html">Go to Main Page.</a>
}
else {
echo 'Not valid';
echo '<p> <a href="player_registration.htm">Return to registration page.</a>';
?>
</body>
</html>
And here's the output after I enter my info:
Go to Main Page. } else { echo 'Not valid'; echo '
Return to registration page.'; ?>
What am I doing wrong?