<!DOCTYPE html>
<html>
<body>
<?php
$servername = "localhost";
$username = "saurabh";
$password = "123456";
$dbname = "saurabh";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$mobile=$_GET["mobile"];
$country=$_GET["country"];
$city=$_GET["city"];
if($city=="select" && $country=="select"){
$sql = "SELECT * FROM regform";
}
else if($city=="select" || $country=="select"){
if($country=="select"){
$sql = "SELECT * FROM regform WHERE city='$city'";
}
if($city=="select"){
$sql = "SELECT * FROM regform WHERE country='$country'";
}
}
else{
$sql = "SELECT * FROM regform WHERE country = '$country' and city='$city'";
}
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<br> username: ". $row["username"]." - Mobile: ". $row["mobile"].
"country: ".$row["country"]." - city: ". $row["city"]."<br>"
;
}
} else {
echo "0 results";
}
$conn->close();
?>
</body>
</html>