Skip to content Skip to sidebar Skip to footer

How To Get A Value Of Html Drop Down Menu Using Php?

I have a HTML script that has a dropdown menu with some options. Once you have selected your topic it goes to my PHP script called process.php. In that process.php it takes the val

Solution 1:

Try following code

<formid="form1"action="help.php"name="form1"method="post"><selectname="pet"id="form"><optionvalue="-1">--Select a Topic--</option><optionvalue="Dog">Dog</option><optionvalue="Cat">Cat</option><optionvalue="Other">Other</option></select></form>

now option that you selected is accessible with $_POST['pet'] in php. also it's a good idea that set your default value to -1

Solution 2:

Give your select tag a "name" attribute.

<select name='form'id='form'>

You should also give your options the same "name" as the select.

Solution 3:

You have process.php in your question and the form action is help.php?

Also, try creating a file you know you have permission to write to, and then attempt to write to that file.

Post a Comment for "How To Get A Value Of Html Drop Down Menu Using Php?"