You are here: Re: retaining value in listbox array « PHP Programming Language « IT news, forums, messages
Re: retaining value in listbox array

Posted by php_Boi on 01/12/07 18:55

Kimmo Laine wrote:
> "php_Boi" <timani27@gmail.com> wrote in message
> news:1168586316.630043.283450@v45g2000cwv.googlegroups.com...
> > <select name="title[]"> //note title[] = an array
> > of titles within the form
> > <option value="1"<?php if ($_POST['title'] == '1') { echo
>
> If you make an array of it, then shouldn't you be looking at the first
> element of the array? $_POST['title'][0]
>
> --
> "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
> http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
> spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)

Yeah that is what i thought too, with a similar syntax. what i mean is
because it can grow and shrink dynamically like there can be 4
responses or one i set a counter like $count and then tried
<option value="1"<?php if $_POST['title'][$count] == '1') { echo
'selected="selected"'; } ?>></option>
but i made a trivial error. the variable i used $count was not in the
scope of these form elements. so i managed to resolve it by using the
counter that "grew" and "Shrunk" the form. if anyone wants to see how
it works email me and i'l send u a copy its pretty nifty.

Thanks Kimmo Laine at least after banging my head against a wall i saw
i wasnt nuts and was on the right track. just needed to pay more
attention to variable scope :)

 

Navigation:

[Reply to this 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

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