2
How to do a query with select option that the user can choose?
On the frontend:
<form method="post" action="Procurarquery.php"  enctype="multipart/form-data">
    <span class="LABEL4CSS" id="LABEL4">Estado</span>
    <select name="estado" size="1" width="195" class="COMBOFABCSS" id="COMBOFAB" tabindex="1">
        <option value="Indiferente">Indiferente</option>
        <option value="Autorizado">Autorizado</option>
        <option value="Condicionado">Condicionado</option>
        <option value="Não Autorizado">Não Autorizado</option>
    </select>
In the backend:
 if (isset($_POST['estado'])) {
     switch($_POST['estado']) {
             case 'Indiferente':
                 $sql = "QUERYYYYYY";
                 $qr = mysql_query($sql) or die(mysql_error());
                 break;
             case 'Autorizado':
                 $sql = "Query Autorizado";
                 $qr = mysql_query($sql) or die(mysql_error());
             break;
Now I have a doubt. If I want to put another one ($_POST['Mes']) How can I select STATUS and MONTH at the same time?
It depends on how you are saving the data in the database. All in a single, separate field...?
– Filipe Moraes
From what I understand you want to know how many choices each opiton value has had, no?
– Samir Braga
This question is unclear... do you want to query the database (Mysql for example) or use a query string (url)? or neither one or the other?
– Sergio
And want to query the database or another page?
– Sergio
I want to query the Database. To show what was requested in the Options value
– ChrisAdler
@user3253195, What is the database? already have? is Mysql? can use jQuery or Mootools for example or prefer simple javascript?
– Sergio
Yes a Mysql Database. I want to use the simplest to display the query
– ChrisAdler