You are invited to Log in or Register a free Frihost Account!

How to create the mobile phone effect

I have a table containing name and address in mysql.I have a form in php which has a textbox where the user can enter the name and clicking the button gets the corresponding address from mysql database.Now I want to modify the script so that when the user is typing the name, the corresponding list of names starting with the letter/letters the user has typed so far should appear in the textbox as a list of alternatives from where the user can choose the name without typing further(Something similar to the phonebook of our mobile phones and something which the browser automaticaly does for the textbox by showing the previous inputs from the cache.).Please help.
You need to either load the whole address book and use javascript on the form and results, or use AJAX. I can't help on either sorry.
I mainly want to know if it is possible to fetch the information from mysql database by using focus/keypress event which requires the integration of javascript and php. Any help?
I'm not 100% sure how you would be able to do this but maybe using javascript you could anchor to a letter in the address book a javascript or ajax would allow you to do this.

Try this site, i think it might be what you're looking for:
- <a href=""> Click Here </a>

Stubru Freak
I'm not going to explain everything, that would be too long, but some hints:
The client-side part:
Use onkeypress (or whatever Javascript event you prefer) to call a function.
The server-side part:
Make a PHP script that expects a POST parameter (like submitting a form, $_POST['...']) with the letters the user entered, that returns a list of names (can be returned as XML, or just plain text, separated by line breaks or anything you want).
The AJAX part, the integration:
Now the hardest part, programming the function called by onkeypress.
- First, get the letters inserted by the user.
- Next, post this data to the PHP page. To do this, take a look at XMLHttpRequest. Tutorial here, basic usage here.
- You will get the raw output of the PHP page, extract the names from it, and present them to the user in some fancy way.
Related topics
ipod + mobile phone wooow
The best mobile Phone
Mobile phone application
Mobile phone with GPS
why the mobile phone you have?
Which is the best Mobile phone
Web Cam on Mobile phone.
Sim and Sim: Mobile Phone Services!
mobile phone where java programming possible
DeviceProgramming-Mobile phone screen capture
Favourite Mobile Phone Software
USB vs Bluetooth for Mobile Phone?
The closest thing to you?
Gmail alerts at you mobile phone by free unlimited sms
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

© 2005-2011 Frihost, forums powered by phpBB.