Drupal Questions & Answers

Ask and answer Drupal related questions! No question too simple or complex!
4 Ace Technologies's picture
Asked by on Thu 23rd Apr 2009
Hi, how can i get a select field value in .inc file using autocomplete_path ?

Hi,
I am using autocomplete_path to my textfield and url callback to a function from where i get the result for suggestions and i also have a select field and i want those suggestion on the basis of select field…
if user select business, function should return business suggestion and if user selects product it should return products suggestions tell me how can i get my select value in .inc file

and this is my function ..please have a look on this and give me suggestiuon how can i do this …
<?php
function riazu_search_for($id){
$output.=’‘;
$suggest_query = db_query(“SELECT distinct(name) FROM {business_listing_keywords}
WHERE name like(’”.$id.”%’)
ORDER BY name
LIMIT 6
“);
$result1 = array();

while($data=db_fetch_array($suggest_query)){
$result1[$data[‘name’]] = $data[‘name’].”\n”;
}

$suggest_query_buisness = db_query(“SELECT distinct(title) FROM {node}
WHERE title like(’”.$id.”%’)
and type=‘business_listing’
ORDER BY title
LIMIT 6
“);

$result2 = array();

while($node = db_fetch_array($suggest_query_buisness)){
$result2[$node[‘title’]] = $node[‘title’].”\n”;
}

$suggest_query_products = db_query(“SELECT distinct(product_title) FROM {upload}
WHERE product_title like(’”.$id.”%’)
ORDER BY product_title
LIMIT 6
“);
$result3 = array();

while($products = db_fetch_array($suggest_query_products)){
$result3[$products[‘product_title’]] = $products[‘product_title’].”\n”;
}

drupal_json(array_merge($result1,$result2,$result3));
exit();
}

Any help will be highly appriciated ??
Thanks,

Commenting on this Drupal Question is closed.