This is the first time ive tried to code anything, A registration form...but it doesnt seem to work
First the HTML
<html>
<head>
<include ="registration.php">
<body>
<form>
<p>Name:<br>
<input type="text" size="20"><br>
<p>Email Address:<br>
<input type="text" size="20"><br>
<p>Username:<br>
<input type="text" size="20"><br>
<p>Password:<br>
<input type="password" size="20"><br>
<p>Verify Password:<br>
<input type="password" size="20"><br>
<br>
<input type="Submit" value="Submit">
</form>
</body>
</html>
now the PHP
<?php
/*
Has user submitted data?
If not, display the registration form.
*/
if (! isset($_POST['submitbutton'])) {
echo file_get_contents("/templates/register.html");
/* Form data has been submitted. */
} else {
$conn = mysql_pconnect("localhost", "corpweb", "secret");
mysql_select_db("mygame");
/* Ensure that the password and password verifier match. */
if ($_POST['pswd'] != $_POST['pswdagain']) {
echo "<p>The passwords do not match. Please go back and try again.</p>";
/* Passwords match, attempt to inster information into userauth table. */
} else {
try {
$_query ="INSERT INTO userauth (commonname, email, username, pswd)
VALUES ('$_POST[name]', '$_POST[email]', '$_POST[username]', md5('$_POST[pswd]'));
$result = mysql_query($query);
if (! $result) {
throw new Exception(
"Registration problems were encountered!"
);
} else {
echo "<p>Registration was sucessful!</p>;
}
} catch(Exception $e) {
echo "<p>".$e->getMessage()."</p>";
} #endCatch
}
}
?>
Thanx for any help given