Jason Wong wrote:
>> Page 2:
>> I want the user to be able to use none, some, or all of the fields,
>> so I
>> don't know how many elements will be in the array.
>>
>> $color[] = $_POST["color"];
>
> That should be:
>
> $color = $_POST["color"];
>
> Actually from your results below it seems like you've enabled
> register_globals
> and it's not necessary to explicit (re)assign $color.
Right. I'm used to working on a machine that doesn't have
register_globals enabled, so it's just habit. Unfortunately, that
particular hosting provider enables them.
>>
>> First question: is there something I can do at this point to cut the
>> empty entries
>
> foreach ($color as $key => $val) {
> if ($val) {
> $tmp[] = $val;
> }
> }
> $color = $tmp;
>
> That will remove empty values from $color.
Ahh. That's exactly what I needed!
Thanks,
Steven
Steven Jarvis
Web Developer
Arkansas Democrat-Gazette
Northwest Edition
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php