Reply to Re: array in $_GET ...

Your name:

Reply:


Posted by Erwin Moller on 06/19/06 08:55

dude wrote:

> Erwin Moller wrote:
>> dude wrote:
>>
>>
>>>i'll try to be short ... i have this in html :
>>>
>>><select name="OS[]" size="5">
>>> <option value="0" selected>Please select one or more...</option>
>>> <option value="1">Windows</option>
>>> <option value="2">Mac OS X</option>
>>> <option value="3">Linux</option>
>>></select>
>>>
>>>and i want to echo the values from this simple list (OS), i mean array
>>>from $_GET array ...
>>>
>>>i did this:
>>>
>>>foreach($_GET as $i => $val)
>>> echo $i . ": " . $val . "<br>";
>>>
>>>but, it only echoes out OS: Array ...
>>>
>>>and this: echo $_GET['OS'][1]."<br>\n"; but it is wrong ...
>>>
>>
>>
>>>how to extract values from OS array inside te GET ? please help ...
>>
>>
>> Hi,
>>
>> Your select is not an array, but a simple value, since only 1 can be
>> selected.
>> So if you want to know what was selected, just use:
>> <select name="OS" size="5">
>>
>> and from PHP: $_GET["OS"]
>>
>> Of course this means the method of the form was GET and not POST, in
>> which case you should use $_POST["OS"]
>>
>> I think you are confusing checkboxes with select.
>> For checkboxes you can use:
>> <input type="checkbox" name="myval[]" value="1">1<br>
>> <input type="checkbox" name="myval[]" value="2">2<br>
>> <input type="checkbox" name="myval[]" value="3">3<br>
>>
>> then from PHP:
>> $myvalArr = $_POST["myval"];
>>
>> Regards,
>> Erwin Moller
>
> thnx, but it is not about checkboxes ... this works fine with checkboxes
> ... not with list :)

Yes it does.
DId you read my first piece of code?

<select name="OS" size="5">
and from PHP: $_GET["OS"]

What is excactly not working?

Regards,
Erwin Moller

[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

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