I have following fields on the form Bank, Personal loan, Home Loan, Education loan Listbox, text box, text box, text box On pressing bank list box I want to show matching record from loan table. How can I do this. Can I attach some event to listbox. All the fields are on the same form
It's very simple. Try to learn some basic PHP online tutorials at http://www.w3schools.com/ Here is the code. No need for any 'event'. echo '<select>'; $res = mysql_query('SELECT loan_id, loan_name from loan_table'); // add your query here if($res){ while($row = mysql_fetch_array($res)){ echo "\t\t<option value=\"" .$row[0] ."\""; if ($row[0] == $sel) echo " Selected"; echo ">" .$row[1] ."</option>\n"; } } echo '</select>'; PHP:
I think it's more to this; echo '<select>'; $res = mysql_query('SELECT loan_id, loan_name from loan_table'); // add your query here if($res){ while($row = mysql_fetch_array($res)){ echo "\t\t<option value=\"" .$row[0] ."\""; if ($row[0] == $sel) echo "selected=\"selected\""; echo ">" .$row[1] ."</option>\n"; } } echo '</select>'; PHP: