Page 1 of 1

autofill search textbox in php file

Posted: Thu Feb 11, 2010 2:26 am
by learnerabn
i want to include autofill technique in search text box in a website.
without using javascript ie using php
the text should be retrived from the mysql database

Re: autofill search textbox in php file

Posted: Thu Feb 11, 2010 3:05 am
by pbs
You have to use some javascript for autofill

You can refer this URLs:

http://www.javascript-examples.com/autocomplete-demo/
http://docs.jquery.com/Plugins/Autocomplete

Re: autofill search textbox in php file

Posted: Thu Feb 11, 2010 4:03 am
by learnerabn
i dont need java script because their we have to give the default strings
i want to store user's search string and get it back(just like google search text box)

Re: autofill search textbox in php file

Posted: Thu Feb 11, 2010 4:27 am
by tamamk
You must have some way of sending back a query from the front end with the strings you want to finish to get a set of results from the backend. PHP as you know, is only backend. Javascript is front end (plus Ajax).

Your call :)

Re: autofill search textbox in php file

Posted: Thu Feb 11, 2010 7:51 am
by learnerabn
i want to store the so far entered user strings in a database.
after that how can i match the currently entered string
with the strings in databases to provide
similar strings?

Re: autofill search textbox in php file

Posted: Thu Feb 11, 2010 9:11 am
by greyhoundcode
So like tamamk said, the best way forward is to attach a javascript event to the text box. Then, every time a key is pressed, your javascript function makes an AJAX call to the relevant PHP script.

Take a look at this page from W3Schools.

Re: autofill search textbox in php file

Posted: Thu Feb 11, 2010 2:09 pm
by learnerabn
k guys
thanks to reply me i think i'll try it using ajax php and java script
i'll try it.