|
Posted by dude on 12/10/61 11:50
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 :)
[Back to original message]
|