-3

i want to make an e commerce website and i want to know how to make filter section where people can omit or select a given variety of product. Something like the one in the image.

enter image description here

Any kind of help will be of great use. Thank you.

harsher
  • 91
  • 2
  • 7
  • 1
    Well... you write all the HTML, CSS, PHP and, presumable, SQL code needed to filter products. That's quite a bit of code. Better get started. If you have a specific question along the way, ask that **specific question**. – deceze Dec 21 '15 at 09:20

1 Answers1

-1

well you can use php like this i am just giving an example here let's say i have a i have to apply filter first to country than to region so your form will go like this

<form action="this.php" method="post">
<input type="text" name="country">
<input type="text" name="region">
<input type="submit" name="submit" value="submit">
</form>

and your php code will go like this

<?php
if(isset($_POST['country'] && !empty($_POST['country']) && isset($_POST['region'] && !empty($_POST['region']))
{
$country=$_POST['country'];
$region=$_POST['region'];
$connection=mysqli_connect('localhost','yourmysqlusername','yourmysqlpassword','youmysqldatabase');
$query="select * from nameofyourmysqldatabase where country='$country' && region='$region';
$result=mysqli_query($connection,$query)
while($row=mysqli_fetch_array($result))
{
//data you want to display from your database
$data=$row['data'];
echo $data;
}

?>

well it's just an example you need to do lot css,php,jquery,html works but i hope you understand the basic behind it

rohitsaroha125
  • 126
  • 1
  • 2
  • 16
  • [Don't check for `isset` *and* `!empty`!](http://stackoverflow.com/questions/4559925/why-check-both-isset-and-empty/4559976#4559976) – deceze Dec 21 '15 at 12:58
  • well it's just an example to show him but i think if both the countryname and region are filled in than it better choice to use it – rohitsaroha125 Dec 21 '15 at 13:00