mfkamande Posted March 3, 2010 Share Posted March 3, 2010 I am new to Web development. Am using PHP and My SQL Database. I am developing a transport management system. To manage users for the system, I have a combobox (select) which lists the user codes. I have a text box input which I want to display the name (other details from the database) every time the selection changes. How do I achieve this? Link to comment https://forums.phpfreaks.com/topic/193971-mysql-forms/ Share on other sites More sharing options...
Dennis1986 Posted March 3, 2010 Share Posted March 3, 2010 If you want this to happen without submitting the form you have to ask in the JavaScript section. You then have 2 options: Javascript with or without AJAX. Without AJAX: Print out the data for the javascript to process with <select onchange="myFunction(this.selectedIndex)"> <script type="text/javascript"> var data = new array(); <?php foreach ($array as $data) { echo "data[" . $data['id'] . "] = $data"; } ?> myFunction(index) { Do stuff with selected index and data here... } </script> With AJAX: Call for data using AJAX again with <select onchange="myFunction(this.selectedIndex)"> but from an external php file. Link to comment https://forums.phpfreaks.com/topic/193971-mysql-forms/#findComment-1020798 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.