I cannot figure out why when submit is pressed, none of the variables are showing up, and a blank entry is being added to the database. please help if you get a chance, below is the code:
<?
mysql_select_db("gtjc",$db);
$query = "SELECT * FROM gtjc_mainpage ORDER BY timepost";
$result = MYSQL_QUERY($query);
$numfound = mysql_num_rows($result);
if($numfound > 0)
{
while ($row = mysql_fetch_array ($result))
{
extract($row);
echo "$id, $subject, $publisher, $message, $timepost";
}
}
else
{
echo "
<BR><BR>
<font class='text'>
Nothing was found in the database.<P>
<img src=\"$baseurl/images/dotbullet.gif\"><a href=\"$PHP_SELF?action=new\">Click here to add a record.</a>
</font>
<BR><BR>
";
}
if($action == "new")
{
if($submit)
{
echo "STUFF: $publisher, $subject, $message, $timepost";
mysql_select_db("gtjc",$db);
$query = "INSERT INTO gtjc_mainpage (subject,publisher,message,timepost) VALUES ('$subject','$publisher','$message','$timepost')";
$result = MYSQL_QUERY($query);
echo "
<font class='text'>
New one, it will be submitted.<P>
<img src=\"$baseurl/images/dotbullet.gif\"><a href=\"$PHP_SELF\">Click here to go back.</a>
";
}
else
{
echo "
<form method=\"post\" action=\"$PHP_SELF?action=new\">
<table border=\"0\" width=\"400\" align=\"center\">
<tr>
<td width=\"100%\" bgcolor=\"#5E84C2\" align=\"center\">
<font class='text'><font color='white'><B>PUBLISHER</B></font></font>
</td>
</tr>
<tr>
<td width=\"100%\" align=\"center\">
<input type=\"text\" size=\"30\" name=\"publisher\">
</td>
</tr>
<tr>
<td width=\"100%\" bgcolor=\"#5E84C2\" align=\"center\">
<font class='text'><font color='white'><B>SUBJECT</B></font></font>
</td>
</tr>
<tr>
<td width=\"100%\" align=\"center\">
<input type=\"text\" size=\"30\" name=\"subject\">
</td>
</tr>
<tr>
<td width=\"100%\" bgcolor=\"#5E84C2\" align=\"center\">
<font class='text'><font color='white'><B>BODY</B></font></font>
</td>
</tr>
<tr>
<td width=\"100%\" align=\"center\">
<textarea name=\"message\" cols=\"45\" rows=\"20\"></textarea>
<BR><BR>
<input type=\"submit\" name=\"submit\" value=\"Submit Information\">
</td>
</tr>
</table>
</form>
";
}
}
?>