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">
<input name="search" type="text" id="search" value="" />
<select name="select" id="select">
<option value="law">law</option>
<option value="economy">economy</option>
<input type="submit" name="submit" id="submit" value="Submit" />
if ($search == "" or $select=="")
 echo "<p>You forgot to enter a word";
//this for Arabic language //
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'];
 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 .
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.