You are here: Re: array in $_GET ... « PHP Programming Language « IT news, forums, messages
Re: array in $_GET ...

Posted by dude on 09/30/53 11:50

> try:
> foreach($_GET['OS'] as $i => $val)
> echo $i . ": " . $val . "<br>";
>
> By the way, I think you're missing the attribute MULTIPLE from the select if
> you want to be able to select multiple items. It should be
> <select name="OS[]" size="5" multiple>
>
> or if you're using xhtml,
> <select name="OS[]" size="5" multiple="multiple">

i did set multiple, and the foreach and the echo result is:
if all the items in the list are selected :
0: 1
1: 2
2: 3
3: 3

if second selected then the echo will be: 0: 1

ok, i can work this way, but can it echo values i mean selected string,
like Windows, Linux, ... , not 0:1, 0:2, etc ...
is it possible ?
eccept if ... or switch condition

foreach($_GET['OS'] as $i => $val)
if($i == 0 && $val == 1)
echo "Windows <br>";
if($i == 0 && $val == 2)
echo "Linux <br>";
... etc

this is too complicated, what if i have 40 items in the list :)

 

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

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