I would love some help if possible, I'm trying to insert rows into a database from a form but I think something is wrong with my $query and I can't figure it out.
the form is this.....
<form name="post" action="insert.php" method="post">
<b>Post Name</b><input type="text" name="postName"><br><br>
<b>Message</b><textarea rows="10" cols="90" wrap name="message"></textarea>
</font>
<input type="submit" value="Post!"> <input type="reset" value="Reset">
and the script is this.....
<?
if (!$postName || !$message)
{
echo "Form not completely filled in, please post again.";
}
$postName = addslashes($postName);
$message = addslashes($message);
@ $db = mysql_pconnect("some.com", "some.domain.com", "some");
if (!$db)
{
echo "Cannot update database, <a href='newPost.php'>go back</a> and try again!";
}
mysql_select_db("some_domain_com");
$query = "INSERT INTO header (postName, message) VALUES ('$postName','$message')";
$result = mysql_query($query);
if ($result)
{
echo mysql_affected_rows()." message inserted into database.<a href='index.php'>Click here</a> to go back";
}
?>
Is the $query the problem or am I missing something else?