Jump to content

Listbox posting


elabuwa

Recommended Posts

Hi guys,

 

I have a list box.

 

say the code is

<select name="drop1" id="Select1" size="4" multiple="multiple">

    <option value="1">item 1</option>

    <option value="2">item 2</option>

    <option value="3">item 3</option>

    <option value="4">item 4</option>

    <option value="0">All</option>

</select>

 

The user will select few items.

How do i capture the data through the "POST" method.

 

$data = $_POST['drop'];

would not work coz there is an array if data.

 

Can any one help or point me in the right direction?

 

Thanks in advance

Link to comment
Share on other sites

A couple of things:

1) Append brackets to your select's name- drop1[]. This will tell PHP to create an array based on the submitted data.

2) Make sure your PHP code references the $_POST element with the same name, minus the brackets- $_POST['drop1'].

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.