Hi,
Anyone sees why I'm getting undefine index for output ?
"Undefined index: id" in /path to/edit.php on line 57
Anyone sees why I'm getting undefine index for output ?
"Undefined index: id" in /path to/edit.php on line 57
Code:
// display initial form with values pre-filled
$submit='';
if (!$submit)
{
// open database connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
// generate and execute query
$slug='';
$content='';
$id='';
$slug = addslashes($slug);
$content = addslashes($content);
Line 57 $id= $_GET['id'];
$query = "SELECT slug, content, contact FROM news WHERE id = '$id'";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
// if a result is returned
if (mysql_num_rows($result) > 0)
{
// turn it into an object
$row = mysql_fetch_object($result);
// print form with values pre-filled
?>
<table cellspacing="5" cellpadding="5">
<form action="<? echo $PHP_SELF; ?>" method="POST">
<input type="hidden" name="id" value="<? echo $id; ?>">
<tr>