*

bobyrou

  • ****
  • 107 posts
php error - Undefined index php error on top of the page
« on: August 31, 2017, 11:44:18 PM »
I am receving this error on top of the page: Notice: Undefined index: Telephone in /home/public_html/themes/theme/item.php

Anyone please know how to fix this?? much appreciated! thanks

And below is my code:

Code: [Select]
<?php
if(osc_item_user_id() <> 0) {
  
$item_user User::newInstance()->findByPrimaryKey(osc_item_user_id());
}

$item_meta_data = array();
$mobile_found true;
while(
osc_has_item_meta())

    
$key osc_item_meta_name();
    
$value osc_item_meta_value();

    
$item_meta_data[$key] = $value;
}

$mobile $item_meta_data['Telephone'];
if(
$mobile == '') { $mobile_found false;}

unset(
$item_meta_data['Telephone']);

if(
$item_extra['i_sold'] == 1) {
$mobile_found false;
$mobile '';
}
?>


*

MB Themes

Re: php error - Undefined index php error on top of the page
« Reply #1 on: September 02, 2017, 04:53:14 PM »
@bobyrou
Change:
Code: [Select]
$item_meta_data['Telephone']
into:
Code: [Select]
isset($item_meta_data['Telephone']) ? $item_meta_data['Telephone'] : ''
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots