Undefined Index problem in PHP Code

I’m using this code to Edit fom.

Error : Notice: Undefined index: Title in C:\wamp\www\MyProject\admin\edit.php on line 96

Here i have paste the coding(I’ve removed some coding part…issue arise on Line 68 in this pasted code )

[php]<?php
$id = isset($_REQUEST[‘Id’]) ? $id = $_REQUEST[‘Id’] : ‘’;
if ($id != 0) {
mysql_connect(“localhost”, “root”, “”) or die(mysql_error());
mysql_select_db(“halftimedb”) or die(mysql_error());
$sql = “SELECT Id,Title,description,Image,Category from News WHERE Id=’” . $id . “’”;
$query = mysql_query($sql);
$row = mysql_fetch_array($query);
?>

Title
Description
Image
Category
>-- Select Category -- >What's New >The Time For a Program >Event Information
<?php

$Title = mysql_real_escape_string($_POST[“Title”]); // <-- Undefined Index Title Line 96
//$description_save = $_POST[‘description’];
//$Category = $_POST[“select_category”];
mysql_query(“UPDATE News SET Title =’$Title’, Description =’$description_save’ WHERE Id = ‘$id’”) or die(mysql_error());
echo “Succesfully Updated!”;
//header(“Location: list.php”);
}
?>
[/php]

You have 2 fields with the same name? Rename the hidden field to something else

also background-color:white; should be style="background-color:white;"

[php] $Title = mysql_real_escape_string($_POST[“Title”]); // <-- Undefined Index Title Line 96[/php]

Shouldn;t it be?
[php] $Title = $row[1]; [/php]

Because you not posting the form on the same page but to edit.php which is another page.

Sponsor our Newsletter | Privacy Policy | Terms of Service