I would like to know the best way to manage the two drop down menu on the PHP page.

1st menu : Select Type of House (House1, House2, )
2nd menu : Select Number of Rooms (1,2 .. 12)

The system should be displayed price based on selected items.

Need your suggestion for manage this system in order to make it easier for future use.

So what is your php problem?

For instance, This is my code and i want to have out put like this:

You have selcted
Diagnostics: Terminites
Number of room = 3
Price is : 105

Thanks in advanced.

        <form align="center" action="demo.php" method="post">        
            <select name="diagnostics">
            <option value="Amiante">Amiante</option>
            <option value="Terminites">Terminites</option>
            <option value="Plomb CREP">Plomb CREP</option>
            <br><br><br>Number of Room:
            <select name="room">
            <option value="95">1</option>
            <option value="100">2</option>
            <option value="105">3</option>
            <option value="110">4</option>
            <input type="submit" value="Valider">

    if ($diagnostics=="Plomb CREP" && $room=="95")
        echo "Price for Plomb CREP : 120 " ; 
        elseif ($diagnostics=="Plomb CREP" && $pieces=="100")
             echo "Price for Plomb CREP : 140 " ;   
        elseif ($diagnostics=="Plomb CREP" && $pieces=="105")
            echo "Prix pour Plomb CREP : 160 " ;    
        elseif ($diagnostics=="Plomb CREP" && $pieces=="110")
             echo "Prix pour Plomb CREP : 180 " ;   
        echo "Diagnostics Price: ", $pieces;    

Well you could write that a bit cleaner :). For example I'd use a switch (but maybe you should think about putting all this in a database).

$diagnostics = $_POST['diagnostics'];
$room = $_POST['room'];

if($diagnostics == 'Plomb CREP')
        case '95':
            $price = 120;
        case '100':
            $price = 140;

        // Etc.

    echo 'Price for Plomb CREP: ' . $price . '<br/>';
    echo 'Diagnostics price: ' . $pieces . '<br/>';

But I'm still not 100% sure what you're trying to achieve. Maybe I can help you better if you'd be a little bit more specific :).

It works..!!
Tahnk you.

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.