Jump to content

php and select element


newman

Recommended Posts

hi . i have an array of multiple select elements :

<select multiple name="addr[]">

<option value=1>first choice
<option value=2>second choice
<option value=3>third choice

</select>

<select multiple name="addr[]">

<option value=1>first choice
<option value=2>second choice
<option value=3>third choice

</select>
i want these two to be in 2 different indexes :

\[0\]=1
\[0\]=2
\[0\]=3

[1]=1
[1]=2
[1]=3


but it creates an array like this :

[0]=1
[1]=2
[2]=3
[3]=1
[4]=2
[5]=3

what's the solution to have an array like the one above ?
thanks in advance .

Link to comment
Share on other sites

thanks for the replies . i tested what akitchin said :

<select name="addr[0]">
<option value="1">
<option value="2">
<option value="3">
</select>

<select name="addr[1]">
<option value="4">
<option value="5">
<option value="6">
</select>

but i get an array like this . the last option of each select element:

Array ( [0] => 3 [1] => 6 )
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.