TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Help with AutoComplete... (http://www.talkphp.com/absolute-beginners/4801-help-autocomplete.html)

gillweb 07-30-2009 05:28 PM

Help with AutoComplete...
 
I am using this script for an auto completer on a project of mine. I have it working perfectly for me BUT i can't get it to also 'auto complete' an ID into a hidden field in my form.

What i need it to do is not only put the 'name' in the text box but also the corresponding ID from the database into a hidden form field. Can someone help me or point me into a direction here?

Thanks. *!*

buildakicker 07-30-2009 08:43 PM

Hi,

Did you update the PHP file?

PHP Code:

$query $db->query("SELECT value FROM countries WHERE value LIKE ‘$queryString%’ LIMIT 10"); 

to

PHP Code:

$query $db->query("SELECT value,id FROM countries WHERE value LIKE ‘$queryString%’ LIMIT 10"); 

Then it looks like you need to update this part to:
PHP Code:

echo &#8216;<li onclick="fill(’‘.$result->value.’‘);">’.$result->value.‘</li>’;
            


to something with ID in it. I am not sure how you are making it work.

Does that helP?

MODNOTE: please use tags that are meant for php. Thank you,

gillweb 07-31-2009 12:54 PM

well i'm not sure if that helps... sounds like it puts me into a direction so I'll have to play with it and report back :-)


All times are GMT. The time now is 01:29 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0