[eluser]Clooner[/eluser]
Added code tags to make it more readable
Code:
<?
else if($page_req==‘shoppinglist’) { ?>
<form action=”<?=base_url()?>checkout” method=“post”>
<table><tr><td>Product Name </td><td>Price</td><td>Quantity</td></tr>
<tr>
<? foreach($this->cart->contents() as $items)
{
?>
<td><? echo $items[‘pname’]; ?> </td>
<td><? } ?> </td>
</tr></table>
<input type=“text” name=“qty”>
</form>
<? } ?>
here is the controllers code below
else if($req==‘shoppinglist’)
{
$req=$this->uri->segment(4);
$sqlselect=“select * from shopping where id=’$req’”;
$query=mysql_query($sqlselect) or die(mysql_error());
while($rec=mysql_fetch_array($query))
{
$id=$rec[‘id’];
$pname=$rec[‘name’];
$pprice=$rec[‘price’];
$qty=$this->input->post(‘qty’);
}
$this->load->library(‘cart’);
$productarray=array(‘id’=>$id,‘pname’=>$pname,‘pprice’=>$pprice,‘qty’=>$qty);
print_r($productarray);
//$data[‘productarray’]=$productarray;
$cartinsert=$this->cart->insert($productarray);
$data[‘title’] = ‘Ziplance Lab Hosting Service| Penny auction script | Dating script | Freelance script | Zip Lance Lab | Ziplancer’;
$data[‘meta_keywords’] = ‘Excellent Penny auction script, Ziplane lab product list.’;
$data[‘meta_description’] = ‘Zip Lance Lab providing excellent product at cheapest rate.’;
$data[‘page_req’]=‘shoppinglist’;
$this->load->view(‘full_page’,$data);
}
Fail: Damn it's still not readable...
It's better to clean your code first... Also use MVC. Breakt down the logic into it's own controller, model and view