I have a combo box which displays a field 'Name' from my database table. What
i want to do is popluate text areas with another field from the same table i.e
Address, Postcode every time the combo box is value changed..
I have a table with fields: Name,Address1,Address2,Postcode
My combo box is linked to the Name field using a mySql query..
On my form i have a combo box and 3 textareas for Address1,Address2 and
postcode..
When the user selects a name in the combo box i want the text areas to
populate with the correct Address etc. data for that name.. I wish this to be
done dynamically and not to load a new page..
This is the code i am using for my combo box..
Code: Select all
<?php
mysql_select_db($dbName);
$sql="SELECT * FROM Supplier";
$result=mysql_query($sql);
echo select name="myselect" size="1"><option style="color: blue"
value="opt1">Supplier</option>";
while ($rows=mysql_fetch_array($result)){
$option= $rows['Supplier_ID'];
$option2= $rows['Name'];
echo ("<option style="color: blue" value="$option">$option
$option2</option>");
}
echo "</select><br/><br/>";
?>of the combo box.. but im not sure how to do this dynamically i.e. not having
to goto another page.
Any help would be greatly appreciated