Re: long PHP array and HTML forms question
| From: | Steven Jarvis | Date: | Thu, 06 Jun 2002 15:00:41 +0000 |
| Subject: | Re: long PHP array and HTML forms question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100939@lists.php.net to get a copy of this message | ||
Jason Wong wrote:
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.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.
Ahh. That's exactly what I needed! Thanks, Steven Steven Jarvis Web Developer Arkansas Democrat-Gazette Northwest EditionFirst question: is there something I can do at this point to cut the empty entriesforeach ($color as $key => $val) { if ($val) {$tmp[] = $val;} } $color = $tmp; That will remove empty values from $color.