In the following code, I am trying to get the value from the dropdown box and show it in the textbox
<html>
<body>
<title>Num One Website</title>
<?
$con = mysql_connect("mysql17.000webhost.com","a6395791_nasser","11a12a13a");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("a6395791_StMarks", $con);
$result1 = mysql_query("SELECT * FROM Students") ;
echo "<FORM>";
echo "<select id='userid' name='userid' onchange='this.form.elements['showuserid'].value=this.options[this.selectedIndex].value'>";
while($row1 = mysql_fetch_array($result1))
{
echo "[COLOR="red"]<option value='".$row1['ID']."'>".$row1['ID']."</option>[/COLOR]";
$count = $count + 1;
}
echo "</select>";
echo "</FORM>";
mysql_close($con);
?>
<form action="ConfirmEnter.php" method="post">
<p>[COLOR="red"]<input id="showuserid" name="showuserid" readonly="readonly" size=5/>[/COLOR]<input type="text" name="name" /><input type="text" name="mt" size=5 value="0.0"/><input type="text" name="pr" size=5 value="0.0" /><input type="text" name="fi" size=5 value="0.0" /><input type="text" name="tot" size=5 /></p><br><br>
</form>
</body>
</html>
Thank you


Sign In
Create Account

Back to top









