Jump to content

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.
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.
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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.