Autopopulate textbox from first textbox

Does anyone know if PHP can do this or if I need like jquery or ajax to get it to work. I have a php form and when an employee enters there name on the first textbox. I want it to auto populate there employee number on the 2nd textbox. There info will be stored on a MySQL DB so I need the data to fetch from there. Does anyone have any info or direction I can go on this? Thank you

You can do it by PHP, but the page will reload.

Or you could use a little bit of JavaScript (I prefer using JQuery Library), Ajax and PHP.

The second option will be seamless to the user and won’t mess up your form like using solely PHP, well that’s not entirely true. However, you will have to go through more hoops solely using PHP.

It’s a server-side client-side difference. PHP only acts on the server and returns the page. Client-side makes a site interactive.

Sponsor our Newsletter | Privacy Policy | Terms of Service