Jump to content

Notice: Undefined index: product_id


randall

Recommended Posts

 

Hi folks, I am having a problem with the following code. it has worked for me for quite some time in many other websites but for some unknown reason it is giving me an error. - this is part of the header for opencart 1.5.1 but it should have nothing to do with it...

 

Error: Notice: Undefined index: product_id in /home/content/42/78114/html/clients/sitename/catalog/view/theme/otp501/template/common/header.tpl on line 16

 

Line 16: $p_code = intval($_GET['product_id']);

 

 


<?php
// Get Product Code From URL
$p_code = intval($_GET['product_id']);

// Return Product Code and Select
$details = "SELECT * FROM oc_product_description WHERE product_id=($p_code)";

$SQ_query = mysql_query($details);
$detail = mysql_fetch_array($SQ_query);
$smalldesc = $detail['description'];
$metadescription=substr($smalldesc, 12, 100);
?>
<title>CO Name: <?php echo $title; ?> </title>
<META NAME="Description" CONTENT="<?php echo $title; ?> - <?php echo $metadescription; ?>">
<META NAME="Keywords" CONTENT="<?php echo $title; ?>, keyword, keyword, keyword, keyword">
<META NAME="author" content="My Name">
<META NAME="copyright" content="CO name">
<meta http-equiv="pragma" content="no-cache">
<META NAME="language" content="en-us">
<META NAME="rating" content="General">
<META name="robots" content="index,follow">
<META NAME="revisit-after" content="7 Days">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href='http://fonts.googleapis.com/css?family=Delius+Swash+Caps' rel='stylesheet' type='text/css'>

Link to comment
https://forums.phpfreaks.com/topic/249657-notice-undefined-index-product_id/
Share on other sites

This is your server simply reporting notices. The other servers were getting this notice, and simply discarding it rather than reporting.

 

If you Google your error 'Notice: Undefined index' you will find your solution. I suggest trying that next time, as you won't have to wait for a response.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.