Re: Using SELECT and MULTIPLE in a form
| From: | John Nichel | Date: | Sun, 02 Feb 2003 03:45:33 +0000 |
| Subject: | Re: Using SELECT and MULTIPLE in a form | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133952@lists.php.net to get a copy of this message | ||
Put empty square brackets (NAME='in_task_descr[]') after the name of your select element. Then all the slections will be in an array called...
$_POST['in_task_descr'] or
$_GET['in_task_descr']
Depending on your form method.
James Kaufman wrote:
I am displaying a form using values obtained from a database query.
One of the elements contains about 20 different values. I want the
use to be able to select multiple values before pressing submit.
This seems to work, but when my php script is called, all I see is
the last data value assigned to the variable. I could use a pointer.
Here is a code snippet:
echo "<TR>\n";
echo " <TD>Task Description</TD>\n";
echo " <TD><SELECT NAME='in_task_descr' MULTIPLE SIZE=4>\n";
for ($j = 0; $j < $tskcount; $j++) {
echo "<OPTION VALUE=\"$taskdescr[$j]\">$taskdescr[$j]</OPTION>\n";
}
echo " </SELECT>\n";
echo " </TD>\n";
echo "</TR>\n\n";
The above code adds a list to the form and the user can highlight more than one
entry.
How do I access the data after the user presses submit?
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com