This is my code, I have one database with three tables(USA,FRANCE and INDIA). When a user select FRANCE in the dropdown,type a name in the input and click search It must search the input value in the selected dropdown table. example1. [if a user select USA and type Marvin, it must search Marvin in a table named USA] example2.[if a user select FRANCE and type SMITH, it must search SMITH in a table named FRANCE]
<select name="country">
<option value="USA">USA</option>
<option value="FRANCE">FRANCE</option>
<option value="INDIA">INDIA</option>
</select>
<input type='text' name='name'>
<input class="SearchButton" type="submit" name="submit" value="Search">
this is my php code
<?php
$conn = mysql_connect("localhost", "root", "");
mysql_select_db("countries", $conn);
//search code
//error_reporting(0);
if($_REQUEST['submit'])
{
$country = $_POST['country'];
$name = $_POST['name'];
if(empty($name))
{
$make = '<h4>You must type a word to search!</h4>';
}
else {
$make = '<h4>No match found!</h4>';
$sele = "SELECT * FROM '%country%' WHERE name LIKE '%$name%'";
$result = mysql_query($sele);
if($mak = mysql_num_rows($result) > 0){
while($row = mysql_fetch_assoc($result)){
echo 'you have selected'.$row['province'].;
}
} else {
print ($make);
}
mysql_free_result($result);
mysql_close($conn);
}
}
?>