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:

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

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

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

MyPage.php:

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.