Click here to Skip to main content
15,918,617 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

I am trying to have an html form, that when the user enters an ID it automatically queries a select command from a mysql database that returns data that are related to his ID

For example:


I want that when the user enters his ID, instantly the name will be filled without using a submit button and he must stay in the same page (to fill other info)

What I have tried:

I've tried to put like a php code inside the "input type="text" value="php script that has select from database"
But it's not working..

Any ideas appreciated.
Updated 15-May-17 5:27am

1 solution

You need AJAX, visit PHP AJAX and MySQL[^]
Share this answer
Member 13201718 15-May-17 11:29am    
Isn't it possible with only PHP? Even if it was bit tricky?
Peter Leow 15-May-17 23:29pm    
PHP scripts run on server-side, you will need AJAX for sending data from the front-end to the server-side asynchronously.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900