fadi.gorie 0 Newbie Poster

Hi guys ,I am trying to design online dictionary using php and autosuggest , I need help in putting some code together ,it is about searching multiple table Using autosuggest by ajax ,the first part I found a solution In this forum using UNION the second part I have a code but I could not apply it cause it has its own structure :
The first part is like following :

<form action=<?php echo htmlentities($_SERVER['PHP_SELF']); ?>
" method="post" enctype="multipart/form-data" name="form" id="form">
<label>
<input name="search" type="text" id="search" value="" />
</label>
<label>
<select name="select" id="select">
<option value="law">law</option>
<option value="economy">economy</option>
</select>
</label>
<input type="submit" name="submit" id="submit" value="Submit" />
</form>
<?php
$search=$_POST['search'];
$select=$_POST['select'];
if ($search == "" or $select=="")
{ 
 echo "<p>You forgot to enter a word";
exit;
} 
$con=mysql_connect("localhost","root","root");
mysql_set_charset('utf8',$con);
//this for Arabic language //
$db-mysql_select_db("word",$con);
mysql_query("set names 'utf-8'");

$sql=mysql_query("select * from law where eng = '$search' UNION select * FROM economy where eng = '$search';");
while ($row=mysql_fetch_array($sql))
{
    echo $row['arb'];
}
$anymatches=mysql_num_rows($sql); 
 if ($anymatches == 0) 
 { 
 echo "Sorry, but we can not find an entry to match your query<br><br>"; 
 } 

?>
/Of course it still needs refining, also this is just a test there are additional tables /
The second part it has many jquery files and script page, therefore I appreciate any help by informing how to add autosuggest using ajax to the code above thanks in advance .