I am developing a PHP web site that uses a search tool in it. I’ll brief it like this,
In the form user will first select Type of the computer (Laptop, desktop or all), then user will select the Brand that he/she expected and also the color or all , if the criteria is matched with the records in the table result should display.
Some times user will select type of the computer and here after by skipping the brand he/she will select the color in that case all brand should display, with specified type and color.
Is any one has completed such a tool pls submit your result back to me.
Pls refer to the Coding HTML / SQL.
Thanks,
email addresses not allowed, removed. - moderator
HTML coding:
[HTML]
<form id="form" name="form" method="post" action = "" >
<select name="type">
<option selected="selected">Select Product Type</option>
<option value="desktop">Desktop</option>
<option value="laptop">Laptop</option>
<option value="all">All Types</option>
</select>
<select name="brand">
<option selected="selected">Select Product Brand</option>
<option value="intel">Intel</option>
<option value="ibm">IBM</option>
<option value="amd">AMD</option>
<option value="toshiba">Toshiba</option>
<option value="all">All Brands</option>
</select>
<select name="color">
<option selected="selected">Select Product Color</option>
<option value="black">Black</option>
<option value="white">White</option>
<option value="Silver">Silver</option>
<option value="all">All Colors</option>
</select>
</form>
[/HTML]
My SQL Code
Expand|Select|Wrap|Line Numbers
- create table products
- (
- p_id int not null primary key,
- p_brand char (15) not null,
- p_color char (10) not null,
- p_type char (10) not null
- )
- insert `products` (p_id,p_brand,p_color,p_type)values ('1001','IBM','Black','Laptop')
- insert `products` (p_id,p_brand,p_color,p_type)values ('1002','Intel','white','Desktop')
- insert `products` (p_id,p_brand,p_color,p_type)values ('1003','Toshiba','Silver','Laptop')
- insert `products` (p_id,p_brand,p_color,p_type)values ('1004','Intel','Black','Desktop')
- insert `products` (p_id,p_brand,p_color,p_type)values ('1005','AMD','white','Laptop')