Two questions.
I am creating a blog but the issue is that when you hit the submit button, it redirects the user(like its supposed to, without errors) but doesn't add the information to the database. Im not sure why, Ive looked over it over and over(find code below).
I am also trying to use tinymce for my form and its not showing up, and I have installed it on my server. Im not sure why thats not happening either.
If you could help that would be great! Here is my code:
<?php
include ('config.php');
@mysql_connect($db_host, $db_user, $db_password) or die('not connected');
// Select the database
$dbc = @mysql_select_db($db_name) or die ('no database selected');
session_start();
if(isset($_POST['submit'])){
$title= $_POST['title'];
$category = $_POST['category'];
$content = $_POST['content'];
mysql_query("INSERT INTO blogData ('title', 'category', 'content') VALUES ('$title', '$category', '$content'");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>The Wacky Wahinis: The Blog, a collective diary and blog of the wacky wahinis!</title>
<link rel="stylesheet" type="text/css" href="demo.css" media="screen" />
<script language="javascript" type="text/javascript" src="tinymce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "textareas",
theme_advanced_buttons1 : "bold,italic,underline,link,unlink,bullist,numlist,outdent,indent,forecolor,fullscreen,code",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left"
}
}
);
</script>
</head>
<body>
<div class="container"><img src="wahinisnew.png" /> </div>
<div class="container"><h1> Add a new post</h1><br />
<form method="post" action="index.php?state=addpost">
<label for="title">Title:</label><br />
<input id="title" name="title" type="text" value="" /><br />
<label for="category">Category</label><br />
<input id="category" name="category" type="text" value="" /><br />
<label for="content">Content:</label><br />
<textarea id="content" name="content" rows="12" cols="60"></textarea><br />
<input name="submit" type="submit" value="submit" />
</form>
</div>
</body>
</html>