Page 1 of 1

Ordering Items

Posted: Wed Nov 02, 2005 9:48 pm
by AliasBDI
I am building a photographer's web site where he offers his clients the option of placing an order online. It is not an eCommerce store, but simulates like one. There is no money transactions going on. The user will navigate to a photo and then add to cart. The items are kept in a SESSION on the server and then the user can go shop for more photos. Once the shopping is completed the user sends the order to the photographer via a form which has been collecting everything they have ordered.

Here is a link to a page where you will see the photo to purchase and the selections/options of what to order from that photo. (http://www.sc-photo.com/order/browsePho ... 27&pID=316)

The navigation is working fine. Here is my problem. I have no idea how to make the forms on this page submit SESSION variables of the selected data (photoID, clientID, photoSIZE(s), etc. (you can see the options on the form). Where should I begin? Where should I turn to get some sort of guidance and direction?

Thanks.

Posted: Thu Nov 03, 2005 5:17 am
by Chris Corbyn

Code: Select all

echo '<input type="hidden" name="something" value="'.$_SESSION['something'].'">';
Use hidden form fields like that and set the value from the SESSION. Submit the form via POST, along with any other user input fields you need. Then you have everything you need. You could also just keep them in SESSION and read them from SESSION again at the processing page.

EDIT | Oh I see.... yes, use hidden form fields. If you need to keep info bundled together you can set your names to be arrays....

Code: Select all

echo '<input type="hidden" name="item['.$_SESSION['id'].']" value="'.$_SESSION['item'].'">';
echo '<input type="hidden" name="size['.$_SESSION['id'].']" value="'.$_SESSION['size'].'">';

//after posting you'd have something like
// $_POST['item'][8743] = 'Red Lantern Photo';
// $_POST['size'][8743] = '6x4';