Am creeat un formular si vreau sa imi afiseze rezultatul in functie de ce alege vizitatorul.
Cod: Selectaţi tot
<form method="post" action="search_cars.php" enctype="multipart/form-data" name="selectate">
<table >
<tr class="required" id="detalii_vehicul">
<td>
<label for="marca">Marca</label> <br/>
<select name="marca" id="marca" >
<option value="0">Selectati</option>
<option value="Acura">Acura</option>
<option value="Aixam">Aixam</option>
<option value="Alfa Romeo">Alfa Romeo</option>
<option value="Aro">Aro</option>
<option value="Aston Martin">Aston Martin</option>
<option value="Audi">Audi</option>
</select>
</td>
<!-- End: Make combo -->
<td class="required">
<label for="marca">Fabricatie</label><br/>
<input type="text" name="data_fabricatie" id="data_fabricatie" value="" size="6" maxlength="4" />
</td>
</tr>
<tr> <!-- End: Sell Month/Year fields -->
<td class="required">
<label for="caroserie">Caroserie</label><br/>
<select name="caroserie" id="caroserie">
<option value="0">Selectati</option>
<option value="cabrio">Cabrio</option>
<option value="berlina">Berlina</option>
<option value="coupe">Coupe</option>
</select>
</td>
<!-- End: Type comnbo -->
<td class="required">
<label for="combustibil">Combustibil</label> <br/>
<select name="combustibil" id="combustibil">
<option value="0">-- Selectati --</option>
<option value="diesel">diesel</option>
<option value="benzina">benzina</option>
<option value="benzina+GPL">benzina+GPL</option>
</select>
</td>
</tr>
<tr>
<!-- Doors combo -->
<td>
<label for="portiere">Portiere</label> <br/>
<select name="portiere" id="portiere">
<option value="0">Selectati</option>
<option value="2/3">2/3</option>
<option value="4/5">4/5</option>
</select>
</td>
<!-- End: Doors combo -->
<!-- Colour Combo -->
<td class="required">
<label for="culoare">Culoare</label><br/>
<select name="culoare" id="culoare">
<option value="">Selectati</option>
<option value="alb">Alb</option>
<option value="albastru">Albastru</option>
<option value="albastru marin">Albastru Marin</option>
</select>
</td>
<!-- End: Colour Combo -->
</tr>
<tr style="text-align:right">
<td colspan="2"><input type="submit" value="Cauta" id="submit" /></td>
</tr>
</table>
</form>
Am incercat multe variante. Am incercat sa pun conditii ca in functie de ce apasa sa imi afiseze
$query = "select * from cars where marca='$marca' and data_fabricatie='$data_fabricatie' and caroserie='$caroserie' and combustibil='$combustibil' and portiere='$portiere' and culoare='$culoare'";
$query am modificat-o in functie de conditia if.
Eu cred ca nu asta e solutia ca sunt atatea posibilitati.
As da si adresa site-ului pt a vedea problema mai usor dar nu stiu dc e corect.
Va rog daca puteti sa ma ajutati