-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsear.php
75 lines (61 loc) · 2.09 KB
/
sear.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!-- <form action="#" method="post">
<input type="checkbox" name="gender" value="Male">Male</input>
<input type="checkbox" name="gender" value="Female">Female</input>
<input type="submit" name="submit" value="Submit"/>
</form>
<?php
if (isset($_POST['gender'])){
echo $_POST['gender']; // Displays value of checked checkbox.
}
?> -->
<form action="#" method="post">
<input type="checkbox" name="check_list[]" value="Price"><label>Price</label><br/>
<input type="checkbox" name="check_list[]" value="Brand"><label>Brand</label><br/>
<input type="checkbox" name="check_list[]" value="Spec"><label>Spec</label><br/>
<input type="submit" name="submit" value="Choose 2 types"/>
</form>
<form method="POST" >
<?php
if(isset($_POST['submit'])){//to run PHP script on submit
if(!empty($_POST['check_list'])){
// Loop to store and display values of individual checked checkbox.
foreach($_POST['check_list'] as $selected){
echo $selected."</br>";
if($selected == "Spec"){
echo "<select name='brand'>";
require_once "config.php";
$query = "SELECT DISTINCT brand FROM laptop";
$result = mysqli_query($link,$query);
while($row=mysqli_fetch_array($result)){
echo "<option value='".$row['brand']."'>".$row['brand']."</option>";
}
echo "</select>";
echo "";
}
if($selected == "Brand"){
echo "BBB";
}
}
}
}
?>
<input type="submit" name="search" value="OK OK K"/>
</form>
<!-- <form method="POST" >
<label for="Manufacturer"> Manufacturer : </label>
<select id="cmbMake" name="Make" onchange="document.getElementById('selected_text').value=this.options[this.selectedIndex].text">
<option value="0">Select Manufacturer</option>
<option value="1">--Any--</option>
<option value="2">Toyota</option>
<option value="3">Nissan</option>
</select>
<input type="hidden" name="selected_text" id="selected_text" value="" />
<input type="submit" name="search" value="Search"/>
</form> -->
<?php
if(isset($_POST['search']))
{
$makerValue = $_POST['brand']; // make value
echo $makerValue;
}
?>