The answer to this has got to be dead simple but I've spent too long already trying to get it right.
I'm trying to pass data via three variables to a database. I use:
reset($_POST);
foreach($_POST as $key => $value){
print $key . " => " . $value . "<br>\n";
}//end foreach
to check that the data is attached to the variable.
The html script is:
<table cellspacing="10" callpadding="0">
<form method="post" action="insertform.php">
<tr>
<td><p><a href="index.php">Read the Story</a></p></td>
</tr>
<tr>
<td>User:</td>
<td><input type="Text" name="user"></td>
</tr>
<tr>
<td>Text:</td>
<td><input type="Text" name="text"></td>
</tr>
<tr>
<td>Date:</td>
<td><input type="Text" name="date"> (eg 2003-04-17)</td>
</tr>
<tr>
<td> </td>
<td><input type="Submit" name="submit" value="Enter information"></td>
</tr>
</form>
</table>
and the php script that handles the form (insertform.php) is:
$result = mysql_query("INSERT INTO storyone VALUES (' ','".$_POST['user']."','".$_POST['text']."','".$_POST['date']."'");
if (!isset($result)) {
echo("<p>Error performing query: " .
mysql_error() . "</p>\n");
exit();
}
My problem is that despite being told that the data has been received and has been sent to the database when I look in the database nothing is there. There aren't even any helpful error messages telling me what's up. Any ideas what I'm doing wrong?