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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.