Posted by Tyno Gendo on 06/08/07 15:50
Iván Sánchez Ortega wrote:
> Mark Winter wrote:
>
>> <SELECT MULTIPLE name="CATEGORIES" size="10" id="CATEGORIES"
> [...]
>> $categories=htmlspecialchars($_POST['CATEGORIES']);
>
> You need to turn that into an array. Keep in mind that a <select multiple>
> returns several GET or POST variables with the same name. So, you'll have
> to use the magic of the [] operator here:
>
> <select multiple='multiple' name='categories[]' ... >
>
> And then, something like:
>
> foreach($_POST['categories'] as $cat)
> {
> echo $cat;
> }
>
if you just want to get the entries as a string to store in the database
and don't want to display them straight away, you could do the following
and not have to recurse through the array:
$categories = (string)@implode(",", $_POST['categories']));
[Back to original message]
|