Notice: Undefined variable: title in E:\xampp\htdocs\blog4\new-post.php on line 11
I keep getting this error and also Missing data is appearing before any data is submitted
include('db.php');
if(isset($_POST['submit'])){
$title = $_POST['title'];
$body = $_POST['body'];
}
if($title && $body){
$query = mysql_query("INSERT INTO posts (title, body) VALUES('$title', '$body')");
if($query){
echo"Post Added";
}else{
echo"error";}
}else{
echo"Missing data";
}