Sorry about the title wasn't sure how to describe my issue in short form.
My problem is this.
I have a dropdown box that is populated from a mySQL database. The reason for this is there are a significant number of options available and much easier to do than code all the options individually.
When the user clicks an option in the drop down box I want the details of some text boxes to change according to the corresponding data in the database to the option the user has clicked.
Hope that makes sense so far.
I am using PHP and mySQL. I understand that Javascript is the way to go, unfortunatly I have not done any other than a few basic tutorials today. I will add the code I have for popultaing the drop down.
[PHP]
<form name="makeorder " action="" method="post">
<label>Select material: </label>
<select id="material" name="material" >
<?php
$sql = "SELECT * FROM upload";
$result = mysql_query($sq l, $db);
echo '<option value="">Select </option>';
while ($row = mysql_fetch_ass oc($result))
{
$mat = $row['mat'];
echo "<option value='$mat'>$m at</option>";
}
echo '</select>';
?>
</form>
[/PHP]
So if the user clicks option 5 then the page will reload and the details relating to that item will be displyed somewhere on the page.
Many thanks in advance
Badvoc
My problem is this.
I have a dropdown box that is populated from a mySQL database. The reason for this is there are a significant number of options available and much easier to do than code all the options individually.
When the user clicks an option in the drop down box I want the details of some text boxes to change according to the corresponding data in the database to the option the user has clicked.
Hope that makes sense so far.
I am using PHP and mySQL. I understand that Javascript is the way to go, unfortunatly I have not done any other than a few basic tutorials today. I will add the code I have for popultaing the drop down.
[PHP]
<form name="makeorder " action="" method="post">
<label>Select material: </label>
<select id="material" name="material" >
<?php
$sql = "SELECT * FROM upload";
$result = mysql_query($sq l, $db);
echo '<option value="">Select </option>';
while ($row = mysql_fetch_ass oc($result))
{
$mat = $row['mat'];
echo "<option value='$mat'>$m at</option>";
}
echo '</select>';
?>
</form>
[/PHP]
So if the user clicks option 5 then the page will reload and the details relating to that item will be displyed somewhere on the page.
Many thanks in advance
Badvoc
Comment