Jump to content

A PHP Error was encountered


colleyboy

Recommended Posts

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 :D

 

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

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.

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.