I have this form
<form method="post" action="new_announcement.php">
<fieldset>
<legend>Create New Announcement</legend>
Subject :<input type="text" style="float-offset: !important;" name="subject" required="required" /><br>
Content :<br />
<textarea rows="10" cols="60" name="content"></textarea> </br></br>
<input type="submit" value="Upload"/>
</fieldset>
</form>
and I want to store the data from my form into a table in my database.
My INSERT INTO code is this...
<?php
include_once 'header.php';
$username = $_SESSION["username"];
if(isset($_POST['username']))
{
$subject = $_POST['subject'];
$content = $_POST['content'];
$sqlinsert = "INSERT INTO announcements (author,subject,content) VALUES ('$username','$subject','$content')";
}
?>
What I am doing wrong and it does not store the data in my database. My database table is the below...
CREATE TABLE announcements
(
id INT UNSIGNED AUTO_INCREMENT,
author varchar(200),
subject varchar(200),
content varchar(3000),
timestamp int(11) unsigned not null,
PRIMARY KEY (id,author)
) ENGINE=MyISAM;