I want a function that will create a JQuery search box based on provide query select strings. It will create a hidden field with the id number associated with the selected value of the search. This id number will be passed and most likely used.
function jquery_search($qs_show, $hidden_name, $pass_var; $main_table, $qs_search=NULL, , $qs_drop = NULL, $style = NULL, $search_name=NULL, $drop_name=NULL) //don't worry about the variables you are not asked to use. They will be implemented later, but we want them in the function for now. Just mark them as null
- puts a search box. It should search the results of $qs_search. It should show in the search box the corresponding results of $qs_show.
when a result is selected, the corresponding $pass_var is put as the value for $hidden_name. If no $pass_var provided, use Primary Key for $main_table.
- if $qs_show is NULL, set it equal to $qs_search
- if $search_name is NULL set search field name to $hidden_name."_search”
- if $style is NULL style and/or class should be name of variable (I don't know exactly which is used by jquery)
- The results of the two queries are connected by the $pass_var. The results of $qs_search are searched, and the results of $qs_show with the same $pass_var are shown.
$qs_show = "select '( ', [url removed, login to view], ')', [url removed, login to view], [url removed, login to view] from table1 JOIN table2 on [url removed, login to view] = [url removed, login to view]"
$hidden_name = "xid"
$pass_var = "[url removed, login to view]"
$qs_search = "select [url removed, login to view] as xid, [url removed, login to view], [url removed, login to view], [url removed, login to view], [url removed, login to view], [url removed, login to view],[url removed, login to view], [url removed, login to view] from table1 JOIN table2 on [url removed, login to view] = [url removed, login to view]"
In this situation, the search box would be called "xid_search" and would have the style/class "xid_search". There would be a hidden variable "xid" which would have the class "xid". When the user typed in xid_search, the page would search the results of $qs_search for matching text. But the user would see the corresponding result of $qs_show. So if they typed the first few numbers of a phone number, the function should find every result of $qs_search for any result with that phone number. The user would see the results of $qs_show that had the same xid as the results of qs_search that matched what the user typed. The idea is to be able to search as many possible fields without forcing the user to see all of the results, just the most important information for them to choose who they want. When the user selected the row they want, the value of the hidden variable "xid" would be set to value of xid from the selected row of the query.
5 freelancers are bidding on average $151 for this job
This is easy task,it can be done with simple Ajax call. I ready to finish it now. For more info please check my profile to see the reference of similar projects.