Re: Differences in arrays
| From: | Richard Lynch | Date: | Thu, 02 Dec 2004 18:36:01 +0000 |
| Subject: | Re: Differences in arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203376@lists.php.net to get a copy of this message | ||
> 1-I guess I need a way to make sure in the foreach
> that when the first empty element is reached the loop
> dies.
Just to be sure you understand:
You should really not die when you hit a blank.
You should just SKIP it and process the rest.
A user *might* choose to fill in the first and third text box INPUTs, and
#2 would be blank. But they'd (rightly) expect you to process #3.
> 2- Why would the second array behave differently then
> the first ?
It's not you.
It's the way HTTP protocol was set up, not really planning for complicated
forms with arrays and such-like.
PHP using arrays (and other languages doing what they do) are mostly
work-arounds of the short-comings of the HTTP protocol.
It would be nice if the HTTP protocol had planned this out a bit better,
and INPUT, SELECT MUTIPLE, CHECKBOX, and RADIO all behaved in a more
rational/similar manner.
OTOH, if you make them too much the same, you'd probably end up having to
do more work for the simple forms. So it goes.
--
Like Music?
http://l-i-e.com/artists.htm