I am new to php. I am just in learning stage.
I created a php page to pull the data through combo box and display into text box on screen. I have done to pull the data that means customer code into combo. But if i select code in combo, the information of code,name , address do not appear in the text box.
Can any body help me to learn?
below is the code.
<?php include("header.php"); ?>
<?php
$result = mysql_query("SELECT * FROM Persons order by code;");
if($row = mysql_num_rows($result)> 0 ) {
// Start combo-box
echo "<select name='code'>\n";
echo "<option>-- Select Item --</option>\n";
// For each item in the results...
while ($row = mysql_fetch_array($result))
// Add a new option to the combo-box
echo "<option value='$row
Code: Select all
'>$row[code]</option>\n";
// End the combo-box
echo "</select>\n";
$strcode=$row['code'];
}
$sqlSelect="SELECT * FROM Persons WHERE code = '$strcode'";
$resultSelect = mysql_query($sqlSelect);
($rowSelect=mysql_fetch_array($resultSelect)) ;
?>
<html>
<head>
<body>
<form method="post">
code: <input type="text" name="code" value="<?php echo $rowSelect['code'];?>" ><br>
name: <input type="text" name="name" value="<?php echo $rowSelect["Name"]; ?>" size='40'><br>
address: <input type="text" name="address" value="<?php echo $rowSelect["Address"]; ?>"><br>
</p>
</form>
</head>
</body>
</html>
Rgd
Maideen