Send Item code value variant on website form

Hi
I have the following form code on a webpage below to allow a customer to select a product quantity and product variant from a website shop. What I would like to be able to do is send a different value to the shopping basket depending on what product variant the customer selects if possible?.
 
So for example if the customer selects “Standard head” the value passed to the shopping cart would be: “2390MSA” but if the customer instead selects: “Compact head” then the value passed to the shopping cart would be: “2390BBB”

Any help on this would be brilliant.

<form action=http://www.companywebsite.com/shop/addtocart.php method=get>
Price &pound;1.99<span class="style1">_______</span>Quantity&nbsp;
<select name=quantity><option>1<option>2<option>3<option>4<option>5<option>6<option>7<option>8<option>9<option>10</select>&nbsp;Variant&nbsp;
<select name=type><option>Standard Head<option>Compact Head</select>
<input type=submit value='Add to Basket'>
<input name="product" type="hidden" value="2390MSA"/>
</form>

The addtocart.php page code is below which sends the information to the romancart shopping cart software:

<iframe src="http://www.romancart.com/cart.asp?storeid=12345&itemcode=<?php echo $_GET['product']?>&quantity=<?php echo $_GET['quantity']?>&itemname2=<?php echo $_GET['type']?>" height="400" width="600" frameborder="0" scrolling="Yes"> IFrame. </iframe>
            </h2>
             <p>&nbsp;</p>
kevin1983Asked:
Who is Participating?
 
MMDeveloperCommented:
Sorry I forgot the closing option tags

<select name="type">
      <option value="2390MSA">Standard Head</option>
      <option value="2390BBB">Compact Head</option>
</select>
0
 
MMDeveloperCommented:
<select name="type"><option value="2390MSA">Standard Head<option value="2390BBB">Compact Head</select>
0
 
kevin1983Author Commented:
ok i tired that but i get this error message when adding either item to the cart:
"XError: 2390MSA is not a valid itemname2 value."
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
kevin1983Author Commented:
maybe the addtocart.php page needs to be modified also: (which includes the name "itemname2")

<iframe src="http://www.romancart.com/cart.asp?storeid=12345&itemcode=<?php echo $_GET['product']?>&quantity=<?php echo $_GET['quantity']?>&itemname2=<?php echo $_GET['type']?>" height="400" width="600" frameborder="0" scrolling="Yes"> IFrame. </iframe>
            </h2>
             <p>&nbsp;</p>
0
 
kevin1983Author Commented:
is this the correct code you think i need?:
<form action=http://www.companywebsite.com/shop/addtocart.php method=get>
Price &pound;1.99<span class="style1">_______</span>Quantity&nbsp;
<select name=quantity><option>1<option>2<option>3<option>4<option>5<option>6<option>7<option>8<option>9<option>10</select>&nbsp;Variant&nbsp;
<select name="type">
      <option value="2390MSA">Standard Head</option>
      <option value="2390BBB">Compact Head</option>
</select><input type=submit value='Add to Basket'>
<input name="product" type="hidden" value="2390MSA"/>
</form>
0
 
kevin1983Author Commented:
Ok ive got it working now, thanks for your help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.