Hello people, Below is the my code linked to my database. When I run it, The form comes up but it shows this error
Notice: Undefined index: Submitform in /Applications/MAMP/htdocs/Register.php on line 93
When I enter the registration information, it doesn't get passed on to the database. Can anybody please advise. My code is displayed below
<html>
<body>
<?php
// If the user wants to register
//if (isset($register))
?>
<table width="500" border="3" align="center" cellpadding="0" cellspacing="5" bgcolor="#CCCCCC">
<tr>
<FORM ACTION="register.php" METHOD=POST>
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Register New Member </strong></td>
</tr>
<tr>
<td width="78">First Name</td>
<td width="6">:</td>
<td width="294"><input name="Fname" type="text" id="Fname"></td>
</tr>
<tr>
<td>Last Name</td>
<td>:</td>
<td><input name="Lname" type="text" id="Lname"></td>
</tr>
<tr>
<td>Email Address</td>
<td>:</td>
<td><input name="Email_Address" type="text" id="Email_Address"></td>
</tr>
<tr>
<td>Username</td>
<td>:</td>
<td><input name="User_name" type="text" id="User_Name"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="Pass_word" type="text" id="Pass_word"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type= SUBMIT name="Submitform" value=" SUBMIT"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<?php
//else:
// Connect to the database server
$dbcnx = mysql_connect('localhost', 'root', 'root') or die("cannot connect");
if (!$dbcnx) {
echo( "<P>Unable to connect to the 'Things Booker' database server at this time.</P>" );
exit();
} else {
echo "DB connection: " . $dbcnx;
}
echo '<pre>';
print_r($_POST);
echo '</pre>';
mysql_select_db("Things_Booker", $dbcnx);
// Select the Things Booker database
if (! @mysql_select_db("Things_Booker") ) {
echo( "<P>Unable to locate 'Things Booker' database at this time.</P>" );
exit();
}
// If User Details Is Submitted,
// add it to the database.
$sql = "INSERT INTO Things_Booker SET " .
"UserID='$User_Name', " .
"FirstName='$Fname', " .
"Surname='$Lname', " .
"Email='$Email_Address', " .
"Password='$Pass_word', " ;
if (mysql_query($sql)) {
echo("<P>Your registration is complete.</P>");
}
else {
echo("<P>Error submitting registration: " .mysql_error() . "</P>");
}
?>
</body>
</html>