Bad Credit Mortgages - Bleach 151 . Bleach 152 - Tsunami Gadgets - McDonalds - Debt Help

PDA

View Full Version : how to show matching record from the table based on the query on listbox


kharearch
Jan 28th 2008, 1:56 am
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. All the fields are on the same form

My code is following through which I am trying to do so. It is just populating the listbox. Please help me. I am a new user.

But on selecting the option from listbox it is doing nothing.

Code –

<body>
<?php
$con = mysql_connect("localhost","sanganak_manish","manish");

if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_db("sanganak_mydata",$con);

echo '<select>';
$res = mysql_query("SELECT name, bplr,auto_loan from loan"); // add your query here
if($res)
{
echo "hay" ;

while($row = mysql_fetch_array($res))
{
echo "india";
echo "\t\t<option value=\"" .$row[0] ."\"";
if ($row[0] == $sel) echo "selected=\"selected\"";
echo ">" .$row[0] ."</option>\n";

}
}
echo '</select>';
?>
<input type="text" name="textfield">
<input type="text" name="textfield2">
</body>

CreativeClans
Jan 28th 2008, 3:28 am
If you want to automatically change the value of the 3 text boxes every time the user selects a bank from the listbox, then you'll have to use javascript, or AJAX.

kharearch
Jan 28th 2008, 7:25 am
Thanks for the reply.