Reply to Re: Someone please explain what this does?

Your name:

Reply:


Posted by Michael Trausch on 04/01/06 08:02

Chris H wrote:
> I have been looking through this script and came across something that I
> dont quite understand how it functions or is used. Basically its brackets
> that are added on at the end of a form field value.
>
> EXAMPLE:
> <input name="eid[]" type="hidden" id="eid[]" value="<? echo $ses_id; ?>">
>
> in other words what does the [] brackets pass to the function thats
> processing the form, basically how is the [] used.
>

PHP sees these types of variables upon submission, and counts them as
variables. You can have twenty items named eid[] and, when the user
presses the Submit button, PHP gets them in $_POST[] as an array. So,
in this case, it would be $_POST['eid'][0] through whatever is the
highest element of the array.

It makes for things that just aren't possible (well, they are possible,
but very tedious to do) without using array functionality in HTML forms.

http://www.webmasterworld.com/forum88/1204.htm is a start, but you can
find a whole world more of information from Google.

You can also explicitly name arrays within your HTML code and PHP will
get them and do the "right thing" with them when the request is sent.
It's actually quite nice.

HTH,
Mike

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация