Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,

I am building a shopping cart for a school exam. It is a custom mug order website. Basically, they want to let people custom design of the mug. I have set the order form like below, I am having some difficulty with the shopping cart. I took the basics of the shopping cart tutorial I found online. The only problem is that most shopping carts send an action and a product id through the URL and into the session for the shopping cart. Well, this custom order form have no id variable to send to cart, only the information will send. How would I code the addtocart.php to remenber all info using session, after yhat display the order detail in cart.php. I have tried manyday, but cannot get the entire thing to work. All help is appreciated. Below is my order form code:

HTML
<div class="custom_order">
<fieldset>
    <legend>Order Custom Mug here</legend>
        <br />
	<form id="custom_orderForm" name="custom_orderForm" method="post" action="custom_cart.php">
    <table width="100%" border="1" cellspacing="0" cellpadding="6">
      <tr>
        <td align="center" width="15%" bgcolor="#C5DFFA">Mug Moder</td>
        <td align="center" width="15%" bgcolor="#C5DFFA">Size</td>
        <td align="center" width="15%" bgcolor="#C5DFFA">Color</td>
        <td align="center" width="25%" bgcolor="#C5DFFA">Message/Text will print at the mug</td>
        <td align="center" width="10%" bgcolor="#C5DFFA">Quantity</td>
        <td align="center" width="10%" bgcolor="#C5DFFA">Price</td>
        <td align="center" width="10%" bgcolor="#C5DFFA">Total</td>
      </tr>
      <tr>
        <td align="center" width="15%">
        	<select id="custom_mugModer" name="custom_mugModer">
              <option value="mug_moder_x">Mug Moder X</option>
              <option value="mug_moder_y">Mug Moder Y</option>
              <option value="mug_moder_z">Mug Moder Z</option>
            </select></td>
        <td align="center" width="15%"><label>
        	<select id="custom_mugSize" name="custom_mugSize">
              <option value="0.3l">0.3L</option>
              <option value="0.5l">0.5L</option>
              <option value="0.7l">0.7L</option>
            </select></td>
        <td align="center" width="15%">
        	<select id="custom_mugColor" name="custom_mugColor">
              <option value="red">Red</option>
              <option value="blue">Blue</option>
              <option value="while">While</option>
              <option value="black">Black</option>
              </select></td>
        <td align="center" width="25%"><label>
        	<input id="custom_mugMessage" name="custom_mugMessage" type="text" size="40" /></label></td>
        <td align="center" width="10%"><label>
        	<input id="custom_mugQty" name="custom_mugQty" type="text" size="6" /></label></td>
        <td  align="center" width="10%"><label>
        	$<input id="custom_mugPrice" name="custom_mugPrice" type="text" size="6" /></label></td>
        <td  align="center" width="10%"><label>
        	$<input id="custom_mugTotal" name="custom_mugTotal" type="text" size="6" /></label></td>
      </tr>
      <tr>
        <td align="center" width="15%">
        	<select id="custom_mugModer" name="custom_mugModer">
              <option value="mug_moder_x">Mug Moder X</option>
              <option value="mug_moder_y">Mug Moder Y</option>
              <option value="mug_moder_z">Mug Moder Z</option>
            </select></td>
        <td align="center" width="15%"><label>
        	<select id="custom_mugSize" name="custom_mugSize">
              <option value="0.3l">0.3L</option>
              <option value="0.5l">0.5L</option>
              <option value="0.7l">0.7L</option>
            </select></td>
        <td align="center" width="15%">
        	<select id="custom_mugColor" name="custom_mugColor">
              <option value="red">Red</option>
              <option value="blue">Blue</option>
              <option value="while">While</option>
              <option value="black">Black</option>
              </select></td>
        <td align="center" width="25%"><label>
        	<input id="custom_mugMessage" name="custom_mugMessage" type="text" size="40" /></label></td>
        <td align="center" width="10%"><label>
        	<input id="custom_mugQty" name="custom_mugQty" type="text" size="6" /></label></td>
        <td  align="center" width="10%"><label>
        	$<input id="custom_mugPrice" name="custom_mugPrice" type="text" size="6" /></label></td>
        <td  align="center" width="10%"><label>
        	$<input id="custom_mugTotal" name="custom_mugTotal" type="text" size="6" /></label></td>
      </tr>
      <tr>
        <td align="center" width="15%">
        	<select id="custom_mugModer" name="custom_mugModer">
              <option value="mug_moder_x">Mug Moder X</option>
              <option value="mug_moder_y">Mug Moder Y</option>
              <option value="mug_moder_z">Mug Moder Z</option>
            </select></td>
        <td align="center" width="15%"><label>
        	<select id="custom_mugSize" name="custom_mugSize">
              <option value="0.3l">0.3L</option>
              <option value="0.5l">0.5L</option>
              <option value="0.7l">0.7L</option>
            </select></td>
        <td align="center" width="15%">
        	<select id="custom_mugColor" name="custom_mugColor">
              <option value="red">Red</option>
              <option value="blue">Blue</option>
              <option value="while">While</option>
              <option value="black">Black</option>
              </select></td>
        <td align="center" width="25%"><label>
        	<input id="custom_mugMessage" name="custom_mugMessage" type="text" size="40" /></label></td>
        <td align="center" width="10%"><label>
        	<input id="custom_mugQty" name="custom_mugQty" type="text" size="6" /></label></td>
        <td  align="center" width="10%"><label>
        	$<input id="custom_mugPrice" name="custom_mugPrice" type="text" size="6" /></label></td>
        <td  align="center" width="10%"><label>
        	$<input id="custom_mugTotal" name="custom_mugTotal" type="text" size="6" /></label></td>
      </tr>
      <tr>
        <td align="center" width="15%">
        	<select id="custom_mugModer" name="custom_mugModer">
              <option value="mug_moder_x">Mug Moder X</option>
              <option value="mug_moder_y">Mug Moder Y</option>
              <option value="mug_moder_z">Mug Moder Z</option>
            </select></td>
        <td align="center" width="15%"><label>
        	<select id="custom_mugSize" name="custom_mugSize">
              <option value="0.3l">0.3L</option>
              <option value="0.5l">0.5L</option>
              <option value="0.7l">0.7L</option>
            </select></td>
        <td align="center" width="15%">
        	<select id="custom_mugColor" name="custom_mugColor">
              <option value="red">Red</option>
              <option value="blue">Blue</option>
              <option value="while">While</option>
              <option value="black">Black</option>
              </select></td>
        <td align="center" width="25%"><label>
        	<input id="custom_mugMessage" name="custom_mugMessage" type="text" size="40" /></label></td>
        <td align="center" width="10%"><label>
        	<input id="custom_mugQty" name="custom_mugQty" type="text" size="6" /></label></td>
        <td  align="center" width="10%"><label>
        	$<input id="custom_mugPrice" name="custom_mugPrice" type="text" size="6" /></label></td>
        <td  align="center" width="10%"><label>
        	$<input id="custom_mugTotal" name="custom_mugTotal" type="text" size="6" /></label></td>
      </tr>
      <tr>
      	<td>Cart Grand Total:</td>
      </tr>
    </table>
    	<div style="text-align:center; margin-removed0.3em;">
    		<input id="custom_mugButton" name="custom_mugButton" type="submit" value="Add to Shopping Cart" />
        </div>
    </form>
</fieldset>
</div>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900