Welcome Guest, Not a member yet? Register   Sign In
Capturing multiple select form input
#1

[eluser]millo[/eluser]
Please help.

I've got a form that looks like this:

Code:
<form action="http://test.dev/admin/document_assign_update" method="post">
<input type="hidden" name="document_id" value="1" />
<select type="text" name="username[]" multiple="multiple" size="4">
   <option value="user1"><br />classname1</option>
   <option value="user2"><br />classname2</option>
   <option value="user3"><br />classname3</option>
</select>
&lt;input type="submit" value="submit" /&gt;
&lt;/form&gt;

How do I capture the data from the multiple select?

I've put something as simple as this in the controller just to see what it outputs (not using any views at the moment):

Code:
function document_assign_update() {
print_r($_POST);
}

When I don't select anything from the drop down and submit I get this output ...

Code:
Array ( [document_id] => 1 )

... which is fine, but then if I select an option from the drop down and then submit I get an error message related to the database:

Code:
An Error Was Encountered

Error Number: 1054

Unknown column 'Array' in 'where clause'

SELECT username, role FROM auth WHERE username = Array AND password = 'd41d8cd98f00b204e9800998ecf8427e'

why am I getting this error when I'm quite simply asking for the post output with print_r($_POST); ???

Can someone see what I'm doing wrong?


Messages In This Thread
Capturing multiple select form input - by El Forum - 07-23-2007, 04:43 PM
Capturing multiple select form input - by El Forum - 07-23-2007, 04:47 PM
Capturing multiple select form input - by El Forum - 07-23-2007, 04:52 PM
Capturing multiple select form input - by El Forum - 02-21-2008, 10:03 AM
Capturing multiple select form input - by El Forum - 02-11-2010, 02:28 PM
Capturing multiple select form input - by El Forum - 02-11-2010, 03:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB