i am new to php.
I am trying to do a search. but not getting how exactly i can achieve this.
Here is my html form
Expand|Select|Wrap|Line Numbers
- <form method="post" action="http://bytes.com/search.php" name="form1">
- Select a color <select> <option value="red">Red</option> <option value="blue">Blue</option> <option value="white">White</option> </select> <br /><br />
- Select cloth <select> <option value="silk">Silk</option> <option value="cotton">Cotton</option> </select> <br /><br />
- Select brand <select> <option value="levis">Levis</option> <option value="ethnica">Ethnica</option> <option value="biba">Biba</option> </select> <br /><br />
- Select type <select> <option value="shirt">Shirt</option> <option value="skirt">Skirt</option> <option value="salwar">Salwar</option> <option value="kurtis">Kurtis</option> </select> <input type="submit" value="go"> </form>
Here i want to display the result from database according to the selection.
if nothing is selected, then i will display all the data.
if only color and brand or only color selected, or brand selected it should display only that.
I am not getting which condition to use.
if i use if- else condition, then my code become repetitive and too lengthy. If i use switch, again i have to use if-else inside it.
please somebody help me. I really need your help