colleyboy Posted August 18, 2010 Share Posted August 18, 2010 I am getting this error on my sales cart page. I am editting a PHP Point of sale program. Cant work out why this is not working. It should display the amount of points the item is worth. Help please Heres the error im getting: A PHP Error was encountered Severity: Notice Message: Undefined index: points Filename: sales/register.php Line Number: 69 Heres the code: <div class='warning_message' style='padding:7px;'><?php echo $this->lang->line('sales_no_items_in_cart'); ?></div> </tr></tr> <?php } else { foreach($cart as $item_id=>$item) { echo form_open("sales/edit_item/$item_id"); ?> <tr> <td><?php echo anchor("sales/delete_item/$item_id",'['.$this->lang->line('common_delete').']');?></td> <td><?php echo $item['name']; ?></td> !!!THIS IS LINE 69 !!! <td><?php echo $item['points']; ?></td> <?php if ($items_module_allowed) { ?> <td><?php echo form_input(array('name'=>'price','value'=>$item['price'],'size'=>'6'));?></td> <?php } else { ?> <td><?php echo $item['price']; ?></td> <?php echo form_hidden('price',$item['price']); ?> <?php } ?> <td><?php echo form_input(array('name'=>'quantity','value'=>$item['quantity'],'size'=>'2'));?></td> <td><?php echo form_input(array('name'=>'discount','value'=>$item['discount'],'size'=>'3'));?></td> <td><?php echo to_currency($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); ?></td> <td><?php echo form_submit("edit_item", $this->lang->line('sales_edit_item'));?></td> </tr> </form> Any ideas? Link to comment https://forums.phpfreaks.com/topic/211109-a-php-error-was-encountered/ Share on other sites More sharing options...
MatthewJ Posted August 18, 2010 Share Posted August 18, 2010 The error is telling you that points is not a valid member of your array... you would need to look at where $item['points'] is being set to determine why it is not. Link to comment https://forums.phpfreaks.com/topic/211109-a-php-error-was-encountered/#findComment-1100961 Share on other sites More sharing options...
btherl Posted August 18, 2010 Share Posted August 18, 2010 If you find that it's not a bug at all and you just want to get rid of that message, you can do this: error_reporting(E_ALL ^ E_NOTICE); Make sure you are 100% sure it's not a bug first though, by doing what MatthewJ said. Otherwise you'll just be hiding the problem instead of fixing it. That message is a "notice" rather than an "error", meaning php is telling you about it, but the script can still continue to run anyway. Link to comment https://forums.phpfreaks.com/topic/211109-a-php-error-was-encountered/#findComment-1100965 Share on other sites More sharing options...
colleyboy Posted August 18, 2010 Author Share Posted August 18, 2010 Excellent... Found out I had not defined it so the php thought - wtf is he on about lol... Thanks & fixed Ian Link to comment https://forums.phpfreaks.com/topic/211109-a-php-error-was-encountered/#findComment-1100975 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.