Jump to content

Archived

This topic is now archived and is closed to further replies.

timcclayton

Populating text form fields from a MySQL database once a user has entered data

Recommended Posts

Hello all.

I have a form with 6 text fields in it. When a user enters information in the second text field, I want PHP to "check" a table on my MySQL database for a corresponding record. If it finds a match, then it populates the final 4 text fields with the relevant information from that record (I imagine this "check" needs to be called every time anything is changed in the second text field?).

Can anybody help me (I am fairly new to PHP and MySQL) ?

Many thanks in advance,
Tim.

Share this post


Link to post
Share on other sites
PHP is being run on your server. It's not a client side language, and that means things cant be changed dynamicly.
But, you can use AJAX to do this. When a fields value is being changed AJAX will send the information to the server on the background (without changing any page etc'), get the information back from the server and use this information in any way you want.
Google for AJAX tutorials.

Orio.

Share this post


Link to post
Share on other sites
Really? Would I be better just doing this in javascript (which I think I will find easier) or does AJAX have advantages over JS

Share this post


Link to post
Share on other sites
You should use combination of JavaScript (fos client side) and PHP/MySQL for Server side

I know how to make it with Flash, because don't use JavaScript...

But, anyway you'll need PHP to check things with database, and some client-side script to trigger PHP when user change data in field.

ok?

if you're using Dreamweaver, check Behaviors panel, there should be some JavaScript behavior for HTML Form fields.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.