Ok, I have tried a billion things. Basically, I'm trying to take some data from a form, and send it to a database. No biggie. For some reason though, when I click submit, it just refreshes the page, no error messages, no confirmation messages, nothing. The problem is not server related, as i have been able to modify the tables using variables before. It would be greatly appreciate if someone could offer any insight on whats happening. Heres the code:
if ($submit) {
// Open connection to the database
mysql_connect(“####”, “##########”, “#####”);
mysql_select_db(“project”);
$query = "INSERT INTO checkin (name,party,smoking, seating,comment) VALUES ($name,$party,$smoking,$seating,$comment)";
$result = mysql_query($query);
if (mysql_affected_rows() == 1) {
$message = "<P>Your information has been recorded.</P>";
$noform_var = 1;
} else {
error_log(mysql_error());
$message = "<P>Something went wrong with your check-in
attempt.</P>";
}
}
// Show the form in every case except successful submission
if (!$noform_var) {
$thisfile = $_SERVER[‘PHP_SELF’];
$message .= <<< EOMSG
<!--****************************************************
Form Display Section-->
<table border=0 cellspacing=1 cellpadding=0 name=table>
<FORM ACTION="$thisfile" METHOD="POST">
<tr align=left><td colspan=2>
<!--****************************************************
Enter Party's Name-->
<h2>Please enter your party's name:</h2></td></tr>
<tr><td valign=middle align=left>
<a href=keyboard.php><img src=name.jpg></a>
<input type=text name="name" align=middle maxlength=20 size=40><br><br>
</td></tr><tr></tr><tr></tr><tr></tr>
<!--**************************************************** Line 100
Party number section-->
<tr align=left><td colspan=2>
<h2>How many people are in your party?</h2></td></tr><tr><td colspan=2>
<!--****************************************
************************************* -->
<input type=text name="party" align=top maxlength=2 size=40> <br><br>
</td></tr> <tr></tr><tr></tr><tr></tr>
<!--*************************************************
Smoking Section -->
<tr align=left><td>
<h2>Smoking Preference:</h2>
<input type="radio" name="smoking" value="1"><b>Smoking</b><br>
<input type="radio" name="smoking" value="0" checked><b>Non-Smoking</b><br><br>
</td><!--
****************************************************
Seating Preferences-->
<td valign=top>
<h2>Seating Preference:</h2>
<input type=radio name="seating" value=1 checked><b>Table</b><br>
<input type=radio name="seating" value=2><b>Booth</b><br>
</td></tr> <tr></tr><tr></tr><tr></tr>
<!--****************************************************
Comment Section -->
<tr align=center><td colspan=2>
<h2>Comments:</h2>
<textarea cols=50 rows=6 name="comment"></textarea><br><br>
</tr></td><tr></tr><tr></tr>
<!-- Submission Section -->
<tr align=left><td>
<input type="submit" value="Submit" align=middle size=10 name="submit"> </td>
<td>
<input type="reset" name="mybutton" value="Clear" size=10>
</td></tr>
</table>
</form> <!-- End Form Display -->
EOMSG;
}
?>
<!-- End Initialization -->
*-->
<!-- Body of the Program
<!-- Heading -->
<center><h1>Title</h1><br><br>
<?php echo $message; ?>
</body>
</html>