简体   繁体   中英

Perform keyword search using PHP

I have three keyword fields like keyword1, keyword2, keyword3 with and/or as dropdown operators in between.

<tr>
    <td>Keywords:</td>
        <td><input name="keyword1" type="text" id="keyword1" /></td>
        <td>
           <select id="operator1" name="operator1">
               <option value="and">AND</option>
               <option value="or">OR</option>
           </select>
       </td>
       <td><input name="keyword2" type="text" id="keyword2" /></td>
       <td>
           <select id="operator2" name="operator2">
               <option value="and">AND</option>
               <option value="or">OR</option>
           </select>
       </td>
       <td><input name="keyword3" type="text" id="keyword3" /></td>
   </tr>

Now if I click on search - the search should check for all possibilities with and/or and yield the results.

The search should happen for all the matching words of array elements like I have Array ( [0] => Array ( [0] => Javascript Application Developer [1] => Job Description:My client is looking for a Application) and so on...

I need it a dynamic way using only PHP..

Any help would be appreciated. Thanks in Advance.

search.onclick = function(){ //ajax request to an validation.php file }

in validation.php accept those variables sent from ajax request.

connect to database. put a query according to your needs.

for ajax,mysql + php,sql check w3schools.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM