Start New Discussion within our Web Development Community

Hello everyone, I'm new to php and i'm developing a website for a school project. I need to implement a combobox with some options, for exemple, if I choose "Alimentation" it appears a table with the specific fields for this option and If I choose other option it appears a table with specific fields for it etc.
The combobox in html has values, if I pass this values to a php variable I think I can do this system
Ex html: <option value = "1"> Alimentation</option>
Ex php: $option1 = the value on the combobox

How can I do this? Do I need to do all of this in php?

You need to post your form and then get the value, something like this:


<form action="MyPage.php" method="post">

    <select name="mySelect">
        <option value="1">My First Option</option>

    <button type="submit">Submit</button>


$selectedOption = $_POST["mySelect"];
// Do something

Hi thankyou for giving me an exemple of what i want to do and sorry for not reply earlier. That's is what i was looking for thankyou.

This question has already been answered. Start a new discussion instead.