productid prdname size color price
101 carpet 40cm red 9000
suppose when i click on the combobox data will show in the 4 textbox , prdname,size,color,price.
i have write this code:
Code: Select all
<tr>
<td width="20%">Product ID</td>
<td>
<select name="productid" onchange='UpdateTextbox(this)'>">
<?php
$query_disp="SELECT productid,prdname FROM carpet order by productid asc";
$result_disp = mysql_query($query_disp, $conn);
while($query_data = mysql_fetch_array($result_disp))
{
?>
<option value="<? echo $query_data['prdname']; ?>.<? echo $query_data['color']; ?>"<?php if ($query_data['productid']==$_POST['productid']) {?>selected<? } ?>><? echo $query_data['productid'];?></option>
<? } ?>
</select>
</tr>
<tr>
<td width="20%">Product Name</td>
<td><input type="text" name="prdname" id="prdname" value="<?php echo $prdname; ?>"></td>
</tr>
<tr>
<td width="20%">Colour</td>
<td><input type="text" name="color" id="color" value="<?php echo $color; ?>"></td>
</tr>
<tr>
<td width="20%">Size</td>
<td><input type="text" name="Size" id="Size" value="<?php echo $Size; ?>"></td>
</tr>
<tr>
<td>Price</td>
<td><input type="text" name="Price" id="Price" value="<?php echo $Price; ?>"></td>
</tr>
<script>
function UpdateTextbox(d){
document.getElementById('prdname').value = d.value;
}
</script>
i am new in php.