0

i have been using this code in creating blog
i'm getting this error on exectute(array($title,$entry); line
the error is

Notice: Undefined variable: title in D:\xampp\htdocs\simple_blog\inc\update.inc.php on line 14

Notice: Undefined variable: entry in D:\xampp\htdocs\simple_blog\inc\update.inc.php on line 14

can any one please help me out.

<?php
if($_SERVER['REQUEST_METHOD']=='POST'

    && $_POST['submit'] =='Save Entry'  
    && !empty($_POST['title'])
    && !empty($_POST['entry'])      

        )
{
    include_once 'db.inc.php';
    $db= new PDO(DB_INFO,DB_USER,DB_PASS);
    $sql="INSERT INTO entries (title,entry) VALUES(?,?)";
    $stmt= $db->prepare($sql);
    $stmt->execute(array($title,$entry));
    $stmt->closeCursor();   

}
else
{
    header('Location: ../admin.php');
    exit;
}
2
Contributors
2
Replies
22
Views
4 Years
Discussion Span
Last Post by kiLLer.zoh_1
1

Variables $title and $entry haven't been defined anywhere in the script. Did you forget to add these two lines:

$title = $_POST['title'];
$entry = $_POST['entry'];
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.