php - Can't make Item name appear when going to different page -


i making store school project , having hard time making text of item name , price saved in variable shown on checkout page.

my code item description looks this:

<div id="section">     <img src="http://ecx.images-amazon.com/images/i/71nodfocvyl._sl1500_.jpg" alt="html         tutorial" style="width:152px;height:172px;border:0;" align="right">     <?php $item->name='asus m32cd desktop'; $item->price='549.99'; $i++; ?>     <h4>asus m32cd desktop</h4>     <h6> $549.99 </h6>     <br> <input type="checkbox" name="item<?php echo $i; ?>" value="<?php echo $item->name.'#'.$item->price; ?>"> &nbsp;buy 

when select , press purchase, takes me checkout page doesn't have items listed. checkout page looks this:

<!doctype html> <!-- harddrive1.html --> <!-- jan 22, 2016 --> <html> <head>   <title>order form</title> </head> <body> <h3>please input information complete order</h3> <?php echo $item->name; ?> <?php echo $item->price; ?> <form action="action_page.php">   first name:<br>   <input type="text" name="firstname" value=""><br>   last name:<br>   <input type="text" name="lastname" value=""><br>   street address:<br>   <input type="text" name="address" value=""><br>   city:<br>   <input type="text" name="city" value=""><br> 

you can avhieve want, catch shopping basket in 3 ways:

1) server side, on session, once user selects item must stored in session, quantity. don't recommend store prices on it, shall fetched data source in order prevent user manipulation of forms.

$_session['cart']['item']=$_post['item_name']  $_session['cart']['item_quantity']=$_post['item_quantity'] 

2). client side, on local storage api, using javascript.

localstorage.setitem("item", "asus m32cd desktop"); 

3) less recommended store on cookie, file created server , deployed on user's hard disk , accessed server.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -