Page 1 of 1

select tag

Posted: Mon Oct 24, 2005 3:46 am
by phoenix121
is it possible to send select + option tags values in a form, and how? my code at the moment is:

Code: Select all

<select name="size">
<option value="256">256KB</option>
<option value="512">512KB</option>
<option value="1024">1MB</option>
<option value="2048">2MB</option>
<option value="4096">4MB</option>
</select>
do i have to give a seperate name for each option tag, or do i just use

Code: Select all

$size = $_POST['size'];
if ($size == 256)
{ ... }
if ($size == 512)
{ ... }
and so on?

Posted: Mon Oct 24, 2005 4:23 am
by dakkonz
what is it that you are trying to achieve here? don't quite get what you mean

Posted: Mon Oct 24, 2005 6:13 am
by Jenk
No, you will only need to use the name given in the name property.

Code: Select all

switch (intval($_POST['size'])) {
    case 256 :
        //do something...
        break;
    case 512 :
        //do something...
        break;

// etc.

}