473,787 Members | 2,971 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 9073
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="multi ple">
<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
7723
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 when CH1 and CH2 have been choosen. $_GET gives me "CH2". Is there any way to get all the choosen channels elements? I would be very appreciative for any help. Thank you in anticipation. Regards
3
2197
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 selected.
4
6133
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 "Three". How do you drop down the list and select a first value ("One") then do the same and select a second value ("Two") so that the value in the field is now "One, Two". I have situations where I need to do this with fields that If there is a...
2
2735
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 second one. I seem unable to do this as it only sends back the first item I select whether I have the CTL key down or not. Upon the return trip, I can select another one, but it still only sends value for the last one I selected. -- MY LISTBOX --...
1
6686
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 | --------------------------------- 1 | --------------------------------- 3 | ---------------------------------
3
11865
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 access_full($file, $access_level) { $template = 'templates/select_tags.tmp'; $select = file_get_contents($template); $template = 'templates/drop_down_option.tmp';
2
4473
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 to do this with a standard asp.net DDL, however it is possible using a html select box, the problem then is getting the values selected on the code behind page. I think in classic asp it would have been something like this:
2
5145
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 1st listbox(PalletNo). Now I want to select miltiple values from that 1st listbox(PalletNo). and based upon this selection from 1st listbox(PalletNo) and combobox(CustomerID) I want to generate list for 2nd listbox(PONo). For example ...
5
2280
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 want to use the select box for this. Can u please help me about this? Thanks in advance
0
9655
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9497
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10169
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6749
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.