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&ch annels=CH2 when CH1 and CH2 have been
choosen. $_GET["channels"] 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
Rolf Wester
----------------
part of the form element:
echo "<select size=5 name=\"channels \" multiple=\"true \">";
echo "<option> CH1 </option>";
echo "<option> CH2 </option>";
echo "<option> CH3 </option>";
echo "<option> CH4 </option>";
echo "<option> CH5 </option>";
echo "</select>"; 6 7715
*** Rolf Wester wrote/escribió (Wed, 21 Jan 2004 12:42:03 +0100): 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&ch annels=CH2 when CH1 and CH2 have been choosen. $_GET["channels"] gives me "CH2". Is there any way to get all the choosen channels elements?
The easiest way is to make channels become an array:
<select name="channels[]"></select>
--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Rolf Wester <we****@ilt.fra unhofer.de> wrote: 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&ch annels=CH2 when CH1 and CH2 have been choosen. $_GET["channels"] 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
Rolf Wester
----------------
part of the form element:
echo "<select size=5 name=\"channels \" multiple=\"true \">";
echo "<select size=5 name=\"channels[]\" multiple=\"true \">";
Makes $channels an array.
HTH;
JOn
Rolf Wester wrote: 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&ch annels=CH2 when CH1 and CH2 have been choosen. $_GET["channels"] gives me "CH2". Is there any way to get all the choosen channels elements?
You've been shown the solution, viz., change your select element's
name to end in "[]". This is actually a FAQ. http://www.php.net/manual/en/faq.htm...elect-multiple
In HTML, the multiple attribute doesn't take the value "true", nor
does it take the value "yes", as PHP.net's FAQ creator would have you
misbelieve. If any of those values are used, it's only by dint of
browsers' error-recovery that users are able to select multiple
options at all. The multiple attribute either takes the value
"multiple", or it can exist in minimised form: only the attribute
value "multiple" is left, i.e.,
<select multiple>
The latter is preferred, according to HTML4.01, sec. B.3.4.
--
Jock
Rolf Wester wrote: 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&ch annels=CH2 when CH1 and CH2 have been choosen. $_GET["channels"] 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
Rolf Wester
----------------
part of the form element:
echo "<select size=5 name=\"channels \" multiple=\"true \">"; echo "<option> CH1 </option>"; echo "<option> CH2 </option>"; echo "<option> CH3 </option>"; echo "<option> CH4 </option>"; echo "<option> CH5 </option>"; echo "</select>";
Thank you all very much for the help.
Rolf Wester
John Dunlop wrote: Rolf Wester wrote:
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&ch annels=CH2 when CH1 and CH2 have been choosen. $_GET["channels"] gives me "CH2". Is there any way to get all the choosen channels elements?
You've been shown the solution, viz., change your select element's name to end in "[]". This is actually a FAQ.
http://www.php.net/manual/en/faq.htm...elect-multiple
In HTML, the multiple attribute doesn't take the value "true", nor does it take the value "yes", as PHP.net's FAQ creator would have you misbelieve. If any of those values are used, it's only by dint of browsers' error-recovery that users are able to select multiple options at all. The multiple attribute either takes the value "multiple", or it can exist in minimised form: only the attribute value "multiple" is left, i.e.,
<select multiple>
The latter is preferred, according to HTML4.01, sec. B.3.4.
Actually, the former is preferred (<select multiple="multi ple"...>)
Attribute minimization is actually forbidden in XHTML, which is the
preferred standard. And just FYI, what you're quoting (the HTML 4.01
Specification) was developed in from 1997-1999 and finally approved in 1999.
This was written when Netscape 4.x was still the primary browser to develop
for. Now, we consider anyone using Netscape 4.x to be a hopeless cause. All
browsers today* (all meaning >99%) support the non-minimized form.
See: http://www.w3.org/TR/xhtml1/#diffs
*Data taken from the W3C, showing that in July 03, 59% were using IE6, 34%
using IE5, 1% using IE4 (all of which supported the non-minimized form) and
only 1% using Netscape 4x. These numbers have likely changed greatly in the
past five months, with the rise of Mozilla and Firebird, and of course the
ever increasing popularity of IE6... I would put the number of users of
Netscape 4.x at well below 1% today. See: http://www.w3schools.com/browsers/browsers_stats.asp
Agelmar wrote: [...] XHTML, which is the preferred standard.
Preferred by whom? Impetuous duhzyners? It's gotta be the X, it sends
them crazy! HTML just lacks that certain X-factor, doesn't it?
:-] http://www.hixie.ch/advocacy/xhtml
(BTW, XHTML1.0 isn't a standard; the W3C isn't -- and can't be -- a
standards body, the far-reaching misconception notwithstanding .)
[The HTML4.01 specification] was written when Netscape 4.x was still the primary browser to develop for.
Ah, are we talking at cross-purposes here? My comments concern
authoring for the WWW, not severely restricted intranets.
--
Jock This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Arvid Andersson |
last post by:
Hello, I need to convert a string to a number, but the string can
contain +,-,* and / as well as parenthesis. For example, if I have the
string "30/(6+9)" I would like a function that returned the number 2.
I actually wrote a java function that did this a couple of years ago, in
school, as an excersise in "binary trees". I lost it, and most of my
programming knowledge, but I figured perhaps there is a way to do this
easily in python? It...
|
by: matatu |
last post by:
Hi to all,
I have a xml file, a substring like:
<a href="#">text</a>
which after an xslt trasform is rendered as (using xsl:output method html):
<a href="#">text</a>
|
by: F. Da Costa |
last post by:
Hi,
Does the following indeed imply that this event is NOT called when an <input type="checkbox" is toggled?
This would thus imply the usage of the onClick handler instead (assuming an action needs to be invoked on check/ uncheck).
W3C Recomendation:
18 Scripts
onselect = script
The onselect event occurs when a user selects some text in a text field. This attribute may be used with the INPUT
|
by: ahaque38 |
last post by:
Hello.
Using A2K SP3, I am having the following problem with a report using
"Sorting and Grouping".
I have recently added a grouping in the reports for
"Category2<>'CONTRACTS'".
I have reports at the plan (overall totals), department and division
levels which have sorting and grouping implemented with this new
|
by: scottyman |
last post by:
I can't make this script work properly. I've gone as far as I can with
it and the rest is out of my ability. I can do some html editing but
I'm lost in the Java world. The script at the bottom of the html page
controls the form fields that are required. It doesn't function like
it's supposed to and I can leave all the fields blank and it still
submits the form. Also I can't get it to transfer the file in the
upload section. The file name...
| |
by: trint |
last post by:
With the following code, I get the "message" whether or not there is
content in my filefield:
function check_file_field()
{
var file_field = document.getElementById("custCartFile");
if(file_field.value.length == 0)
{
alert("You are required to select an Image");
return false;
|
by: Fary4u |
last post by:
Hi Guys
i'm trying to upload a file, i've tried 3 different methods but still not work out i don't know how to over come this problem
hidden file value, multiple form or popup uploading.
1-
<SCRIPT TYPE="text/javascript">
function popupform(myform, windowname)
|
by: Webstorm |
last post by:
Hi, I hope someone can help me sort this out a bit, Im completely lost.
Here is the page I am working on:
http://www.knzbusinessbrokers.com/default.asp
I have 3 search critera that I need to use when querying the database. Right now it is only looking for a match on one of those dropdowns and not all 3. can anyone help?
Here is the code:
<form BOTID="0" METHOD="POST" action="businessforsale_interface/Results/test3.asp">
|
by: justice750 |
last post by:
Hi All,
I am using a FormView control. The allows me to update records in the database. However, when a database field is null I can not update the field on the form. It works fine when the field is not a null value. I am not using any code behind (C#) to bind the data or manipulate the data.
I have read that when there is a null value in the database that there is no record in the "dataset". Can anyone show me how to bind a value in the...
|
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...
|
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,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |