timcclayton Posted July 22, 2006 Share Posted July 22, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/15356-populating-text-form-fields-from-a-mysql-database-once-a-user-has-entered-data/ Share on other sites More sharing options...
timcclayton Posted July 23, 2006 Author Share Posted July 23, 2006 Sorry to bump this thread, but does anyone know if this is feasible? Quote Link to comment https://forums.phpfreaks.com/topic/15356-populating-text-form-fields-from-a-mysql-database-once-a-user-has-entered-data/#findComment-62346 Share on other sites More sharing options...
Orio Posted July 23, 2006 Share Posted July 23, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/15356-populating-text-form-fields-from-a-mysql-database-once-a-user-has-entered-data/#findComment-62348 Share on other sites More sharing options...
timcclayton Posted July 23, 2006 Author Share Posted July 23, 2006 Really? Would I be better just doing this in javascript (which I think I will find easier) or does AJAX have advantages over JS Quote Link to comment https://forums.phpfreaks.com/topic/15356-populating-text-form-fields-from-a-mysql-database-once-a-user-has-entered-data/#findComment-62361 Share on other sites More sharing options...
hardyvoje Posted July 23, 2006 Share Posted July 23, 2006 You should use combination of JavaScript (fos client side) and PHP/MySQL for Server sideI 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. Quote Link to comment https://forums.phpfreaks.com/topic/15356-populating-text-form-fields-from-a-mysql-database-once-a-user-has-entered-data/#findComment-62383 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.