select tag

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phoenix121
Forum Commoner
Posts: 28
Joined: Sun Sep 25, 2005 9:09 pm
Location: New Zealand

select tag

Post 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?
dakkonz
Forum Commoner
Posts: 69
Joined: Sat Dec 27, 2003 2:55 am
Location: Asia

Post by dakkonz »

what is it that you are trying to achieve here? don't quite get what you mean
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post 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.

}
Post Reply