Select multiple doesn`t work

K

Kamyk

Hello all!

I have a problem with SELECT MULTIPLE, because it doesn`t work at all. I
cannot select a few values.
I mean fields: "Preferowane dania" (Dishes prepared) and "Preferowany
kontakty" (Contacts prefered).
Here is my web page:

http://www.karczmapolska.com.pl/_rezerwacja.php?typ=rezerwacja_imprezy_okolicznosciowej

Moreover, how would I get the each of selected value. What is the code for
it?

Sorry, but my page is in Polish.

Thank you in advance
Marcin from Poland
 
D

David Dorward

Kamyk said:
I have a problem with SELECT MULTIPLE, because it doesn`t work at all. I
cannot select a few values.

Its a "feature" of PHP. You can only have multiple values for one control
name if that control name ends with the characters "[]".
 
J

Jan Faerber

David Dorward ... output:
Kamyk said:
I have a problem with SELECT MULTIPLE, because it doesn`t work at all. I
cannot select a few values.

Its a "feature" of PHP. You can only have multiple values for one control
name if that control name ends with the characters "[]".

?

<input type="checkbox" name="preferowane_danie1" value="obiad" >obiad<BR>
<input type="checkbox" name="preferowane_danie2" value="deser" >deser<BR>

or

<input type="checkbox" [...] checked>obiad<BR>
<input type="checkbox" [...] checked>deser<BR>

SELECT MULTIPLE you use in "pop-up" menus -
then you can choose more than one option by pressing the [Ctrl] / [Strg] key
while clicking the (left) mouse button - e.g.:

<select name="count" size="5" multiple>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
 
D

David Dorward

Jan said:
Its a "feature" of PHP. You can only have multiple values for one control
name if that control name ends with the characters "[]".
<input type="checkbox" name="preferowane_danie1" value="obiad" >obiad<BR>
<input type="checkbox" name="preferowane_danie2" value="deser" >deser<BR>

Which, assuming both checkboxes were checked, would give one value for each
of two different names.

On the other hand, if they both were called "preferowane", then PHP would
ignore one of them. If they were both called "preferowane[]", then PHP
would present them as an array.

This is country to every other language I've worked with, all of which
present multiple values for the same name as an array no matter that name
is.
SELECT MULTIPLE you use in "pop-up" menus -

Browsers typically render <select> elements which are not multiple as drop
down menus. Those which are multiple, on the other hand, are typically
rendered as list boxes.
then you can choose more than one option by pressing the [Ctrl] / [Strg]
key while clicking the (left) mouse button - e.g.:

<select name="count" size="5" multiple>

Although in this example, only one value would appear in in the $_REQUEST
superglobal array as the name does not end in the characters "[]".
 
J

Jan Faerber

David Dorward ... output:
Jan said:
Its a "feature" of PHP. You can only have multiple values for one
control name if that control name ends with the characters "[]".
<select name="count" size="5" multiple>

Although in this example, only one value would appear in in the $_REQUEST
superglobal array as the name does not end in the characters "[]".

OK - I am not that far.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top