473,505 Members | 16,940 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HTML SELECT multiple VALUES?

3 New Member
I am writing a code for a shopping cart, the customer selects the color, which also has the price. I want to send the color and the price to "price" and "color" on the mysql server. How do I code a SELECT to send two different variables to two different mysql names?

I have this right now....

Expand|Select|Wrap|Line Numbers
  1.           echo "<select name='priceBox' name2='colorBox'>";
  2.  
  3.              echo "<option value='" . $prodrow['price'] . "' value2='" . Black . "'>Black $" . $prodrow['price'] . "</option>";
  4.              echo "<option value='" . $prodrow['price2'] . "' value2='" . White . "'>White $" . $prodrow['price2'] . "</option>";
  5.              echo "<option value='" . $prodrow['price3'] . "' value2='" . None . "'>No Paint $" . $prodrow['price3'] . "</option>";
  6.  
  7.          echo "</select>";
It doesn't work, so I want to know if there is a way to do this... thank you.
Feb 19 '09 #1
3 9055
drhowarddrfine
7,435 Recognized Expert Expert
Simple answer. You can't.
Feb 19 '09 #2
TheServant
1,168 Recognized Expert Top Contributor
One way you can do it is do the work where the form is submitted to. So have your value (you can only have one) as "option 1" or something and then include in your form processing code something like:
Expand|Select|Wrap|Line Numbers
  1. if ( $_POST['priceBox'] == "option 1" ) {
  2. $price = $prodrow['price'];
  3. $color = "black"
  4. } elseif  ( $_POST['priceBox'] == "option 1" ) {
  5. ...
  6. }
Just remember html forms are really just text, so you need to do the work in javascript or PHP. Another way would be to have a hidden input box and then use javascript to change the value of it as the user selects a different option. There are hundreds of other ways I am sure, but as drhowarddrfine said, not that way.
Feb 19 '09 #3
Bharat383
93 New Member
<SELECT ID="Select1" NAME="Select1" multiple="multiple">
<OPTION VALUE="1">1</OPTION>
<OPTION VALUE="2">2</OPTION>
<OPTION VALUE="1">1</OPTION>
<OPTION VALUE="2">2</OPTION>
<OPTION VALUE="1">1</OPTION>
<OPTION VALUE="2">2</OPTION>
<OPTION VALUE="1">1</OPTION>
<OPTION VALUE="2">2</OPTION>
<OPTION VALUE="1">1</OPTION>
<OPTION VALUE="2">2</OPTION>

</SELECT>
May 19 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
7704
by: Rolf Wester | last post by:
Hi, I have a form with a select element with multiple="true". When using the GET method (I suppose the same happens with the POST method) I can seen that the form sends channels=CH1&channels=CH2...
3
2179
by: larsmtl | last post by:
Howdy all, Is there an easy way to return all items of an "HTML select multiple" even if they aren't highlighted? form=cgi.FieldStorage() form.getlist("box") only returns those that are...
4
6098
by: LD | last post by:
Is there a way in Access to store more than one value in a field that has been selected from a combo box? For example, if a combo box had three values that you can select, "One", "Two", and...
2
2714
by: DC Gringo | last post by:
I have two listboxes, the first of which is an autopostback=true that allows multiple row selection. When I select multiple values (by holding down CTL) in the first one, it should query the...
1
6650
by: sverdlov | last post by:
Hi all, I have, let's say, 1 column called Payment_type. In the column, there are 6 types of values: 1, 2, 3, 4, 5, 6, like in --------------------------------- Payment_type |...
3
11854
by: robski | last post by:
Hello there, I am new to this forum and have done my best to look around for a solution to this problem. I am using PHP to generate an HTML Select drop down menu, with 4 options: function...
2
4462
by: Problematic coder | last post by:
I have a need in an application to have the ability to select multiple values in some kind of drop down list or maybe even a html type select box. I have found there doesn't seem to be an option...
2
5103
by: billa856 | last post by:
Hi, My Project is in MS Access. In that I have one form in which I have some textboxes,comboboxes and listboxes. Now when I select value from 1st combobox(CustomerID) then it wil generate list for...
5
2273
by: sarayu | last post by:
Hi All, How can i select multiple values in a form without using options.I want to select more than one image from a table and submit those selected values as a request to the next page.I don't...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7103
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5035
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4701
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.