473,748 Members | 4,067 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing all <option> from <select> to php

Hey,

I wondering if it's possible to retrieve all the <option>-fields from a
<select> when posting a <form> to a php file

Example:
I've got a form like this:

<form action = phpfile.php method=post >
<select name= "name">
<option value="1">1</option>
<option value="2">2</option>
</select>
</form>

and a php file where i retrieve the posted date:

$name=$_POST["name"];

but how can i get the value of option 1 and option 2 no matter if they are
selected or not?

Anybody knows?
Jul 20 '05 #1
1 2415
Lee
Ang Talunin said:

Hey,

I wondering if it's possible to retrieve all the <option>-fields from a
<select> when posting a <form> to a php file


It might help to know why your PHP script cares about the
options that haven't been selected.

If the options aren't likely to ever change, hard code them
into your PHP script. If they are generated dynamically,
you could also create a hidden form field that lists all of
the options.

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1715
by: George Hester | last post by:
Try it. Using Microsoft Internet Explorer 5.5 SP2 (that's the version I am using) in Windows 2000 SP3: In a html put this in: <select type="select-one" id="oSel1"> <option value="1" onmouseover="JavaScript:window.status='Hello'; return true;">Hello</option> <option value="2" onmouseover="JavaScript:window.status='Bye'; return true;">Bye</option> <option value="3" onmouseover="JavaScript:window.status='Dammit'; return...
2
7121
by: LC's No-Spam Newsreading account | last post by:
I have a form arranged in a table (you can see an example in the page http://cosmos.mi.iasf.cnr.it/~lssadmin/Website/LSS/Help/query.html) The table is on three columns but has a structure like this. The part I'm concerned with is the cell FFFFF which contains a multiple <SELECT> list of <OPTION>s. As you can see the first two rows span more than one column (if this has any importance). What I want is to constrain FFFFF not to exceed a...
2
1948
by: Craig Keightley | last post by:
How do I retrive the Name of the item in a select box I have the following form <select name="select"> <option value="1">Monday</option> <option value="2">Tuesday</option> <option value="3">Wednesday</option> <option value="4">Thursday</option> </select>
3
18588
by: Iain Hallam | last post by:
Hi. I've been using display:none on the style property of some <option> elements in my forms, which works fine with Mozilla - as expected it removes the option from my dropdown (although it still exists in the code). Is there an equivalent in IE? The reasoning behind this is that I want users to rank objects using a <select> for each place (see below), and to remove the choice of earlier objects from <select> drop-downs later in the...
6
2408
by: Bonge Boo! | last post by:
This has got to be obvious, but I can't make it work. I have a form called with 3 pull down menus. They are linked to a database which generates the values for the <SELECT? Pull-downs. Lets say I have values selected for all three pull down menus. When I change the first "top-level" menu I want to reset both the second and third menus to the "default" state.
6
19614
by: joseph.lindley | last post by:
Forgive me for I am a bit of a web-dev novice - but I'm not doing too bad. I'm currently working with a bit of javascript to dynamically add <option>s into a select box. My code currently works fine in Internet Explorer, however in Firefox the dropdown only displays the first option in the list, and when clicked the other values aren't displayed. Here is the code;
5
1879
by: bb nicole | last post by:
Below is the list menu of search engine.. How to code if i want to put <option selected>ALL</option> Interface <tr> <td>Job Category:</td> <td><select name="jobCategory"> <option selected></option>
9
5785
by: eihabisaac | last post by:
hey every body how can i get using javascript the selected option <option> ID or Value because when ever i clicked it i get the <select> id and i dont want that <select name="list" id="list" size="10%" > <option id="3" ondblclick="select_song();">Apple <br> </option> <option id="4" ondblclick="select_song();">Orange <br> </option> <option id="5" ondblclick="select_song();">Banana<br> </option>
3
2725
by: sreemathy2000 | last post by:
I have the below code in the form for the select dropdown in my web page. how can i get the selected text from javascript. i was able to get the value, but text shows as undefined. <SELECT name="queue" id="queue"><OPTION selected value="0">Select reason</OPTION><option value="Residential Tier 1 Chat" text="Account Information">Account Information</option><option value="NEW Residential Tier 1 Chat" text="Billing Inquiry">Billing...
0
8830
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,...
1
9324
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
8243
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...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
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
4606
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...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
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 we have to send another system
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.