I am trying to insert some data from a form to a mysql table all in ONE PAGE. Here is my code:
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST>
<P>Insert your info below to submit into news database:
<P>
Title:
<input name="title" type="text" id="title">
<P>Author:
<select name="author" size="3" id="author">
<option value="author1">Author 1</option>
<option value="author2">Author 2</option>
<option value="Author 3">Author 3</option>
</select>
<P>Email:
<select name="email" size="3" id="email">
<option value="email1@domain.com">Author 1
<option value="email2@domain.com">Author 2
<option value="email3@domain.com">Author 3
</select>
<P>Insert your News:
<textarea name="textarea" cols="90" rows="10"></textarea>
<BR>
<INPUT TYPE=SUBMIT VALUE="SUBMIT">
</FORM>
<?php
if ($submit){
$con = mysql_connect("localhost","user","pw");
mysql_select_db("news",$con);
$action = "INSERT INTO news (title,author,authoremail,html,date) VALUES ($title,$author,$email,$html,date == date())";
$query = mysql_query($action,$con) or die ('Could Not Insert News');
echo 'inserted successfully';
}
?>
I test it on the server and nothing happens. Where am I messing up?