I have the form, the database is created, the table is created (cheated with phpmyadmin a bit), I can insert data manually with phpmyadmin but my script will not do anything. It doesn't even return an error or a success message. Please see the scripts below
index.php file
<html>
<body>
<form>
<FORM action="addgames.php" method="post">
<P>
<LABEL for="matchup">Game Entry: </LABEL>
<INPUT type="text" name="matchup" id="matchup"><BR>
<LABEL for="visitorodds">Visitor Odds: </LABEL>
<INPUT type="text" name="visitorodds" id="visitorodds"><BR>
<LABEL for="tieodds">Tie Odds: </LABEL>
<INPUT type="text" name="tieodds" id="tieodds"><BR>
<LABEL for="homeodds">Home Odds: </LABEL>
<INPUT type="text" name="homeodds" id="homeodds"><BR>
<INPUT type="submit" value="Input Game"> <INPUT type="reset">
</P>
</body>
</html>
Then the addgames.php file
<?php
$host="localhost"; // Host name
$username="chuck_site"; // Mysql username
$password="Hot55dog"; // Mysql password
$db_name="chuck_site"; // Database name
$tbl_name="week4"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Get values from form
$matchup=$POST['matchup'];
$visitorodds=$POST['visitorodds'];
$tieodds=$POST['tieodds'];
$homeodds=$POST['homeodds'];
// Insert data into mysql
$sql="INSERT INTO $tbl_name(matchup, visitorodds, tieodds, homeodds)VALUES('$matchup', '$visitorodds', '$tieodds', '$homeodds')";
$result=mysql_query($sql);
// if successfully insert data into database, displays message "Successful".
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='index.php'>Back to main page</a>";
}
else {
echo "ERROR";
}
// close connection
mysql_close();
?>
If anyone can help and tell me why nothing is making it to my db table I would greatly appreciate it.