<select> with PHP?

If I have this code in a form:

[code]

Not related to a team Men's 1st Team Men's 2nd Team Men's 3rd Team Ladie's 1st Team Ladie's 2nd Team Juniors [/code] and say for example "Juniors" is selected, how do I get $team=6?

I know value="<?php echo $content_short ?>" works for other form elements but it doesn’t seem to work here.

How do I do it?

You have it…

When someone selects Juinors it will set $team = 6.

This is because you have select name = team. So whatever option you select becomes that names value.

Get what I am saying or am I missing what you are saying?

Yes, like Ragster00 mentioned, the select name will be your variable. If you have values specified it will echo those, if you dont it will echo whats between the option tags.

Finally, you should make sure you access the variable using the superglobals $_POST or $_GET, whichever you think is best.

Sponsor our Newsletter | Privacy Policy | Terms of Service