skip to Main Content

When i open the website i get a error at the footer

Notice: Undefined index: product_id in /home/abc/public_html/wp-content/themes/abc/footer.php on line 70

Here is the code :

<?php wp_footer(); 
if($_GET['product_id']&&$_GET['product_id']!=""){
$product_id = $_GET['product_id'];
echo '<input type="hidden" id="product_id" value="'.$product_id.'" />';
echo '<input type="hidden" id="product_name" value="'.get_the_title($product_id).'" />';
}
?>

Can anybody help fix this issue, i checked with all the php.in and plugins issue but i found no issue in plugin.

2

Answers


  1. Chosen as BEST ANSWER

    there is same error no change with your code also


  2. Hope This code will help you

    if( $_REQUEST['product_id'] && $_REQUEST['product_id'] != "" ){
        $product_id = $_REQUEST['product_id'];
        echo '<input type="hidden" id="product_id" value="'.$product_id.'" />';
        echo '<input type="hidden" id="product_name" value="'.get_the_title( $product_id ).'" />';
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search