My mysql insert statement goes through when I manually insert it, however, the form will not post. Any help is appreciated.
The Form
<form method="post" action="">
<h4>Title</h4>
<input type="text" id="post_title" />
<h4>Location</h4>
<input type="text" id="post_location" />
<h4>My Tale</h4>
<textarea id="post_content" ></textarea>
<input type="submit" value="Share"/><br />
</form>
The Form Processor
<pre>
if (isset($_GET['success']) === true) {
echo 'Your journal entry has been added';
} else {
if (empty($_POST) === false && empty($errors) === true) {
$post_data = array(
'post_title' => $_POST['post_title'],
'post_location' => $_POST['post_location'],
'post_content' => $_POST['post_content']
);
add_post($user_id, $post_data);
header('Location: settings.php?success');
exit();
} else if (empty($errors) === false) {
echo output_errors($errors);
}
?>
</pre>
The Function that handles the post process
<pre>
function add_post($blog_author, $post_data) {
$post = array();
array_walk($post_data, 'array_sanitize');
foreach($post_data as $field=>$data) {
$post[] = '`' . $field . '` = \'' . $data . '\'';
}
mysql_query("INSERT INTO user_blog (`post_author`,`post_title`,`post_location`,`post_content`) VALUES ('$blog_author','post_title','post_location','post_content')");
}
</pre>
There are no errors, which merely check for blank form fields. There seems to be an issue between the post and the function, but I can't pin down the issue.