autofill search textbox in php file

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
learnerabn
Forum Commoner
Posts: 48
Joined: Wed Feb 10, 2010 12:56 am

autofill search textbox in php file

Post 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
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: autofill search textbox in php file

Post 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
learnerabn
Forum Commoner
Posts: 48
Joined: Wed Feb 10, 2010 12:56 am

Re: autofill search textbox in php file

Post 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)
tamamk
Forum Commoner
Posts: 25
Joined: Sun Aug 24, 2008 3:37 am

Re: autofill search textbox in php file

Post 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 :)
learnerabn
Forum Commoner
Posts: 48
Joined: Wed Feb 10, 2010 12:56 am

Re: autofill search textbox in php file

Post 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?
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: autofill search textbox in php file

Post 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.
learnerabn
Forum Commoner
Posts: 48
Joined: Wed Feb 10, 2010 12:56 am

Re: autofill search textbox in php file

Post by learnerabn »

k guys
thanks to reply me i think i'll try it using ajax php and java script
i'll try it.
Post Reply