Hi
I have a mysql table (numberlist) with 2 fields: number and name. In php I've made the connection and create dropdown list that displays the selected number from calls table.
I want to display the name for the selected number in a text field. I was told that I can do it with javascript, but I dont know javascript, This my code:
I will appreciate your help, Thanks!!!
I have a mysql table (numberlist) with 2 fields: number and name. In php I've made the connection and create dropdown list that displays the selected number from calls table.
I want to display the name for the selected number in a text field. I was told that I can do it with javascript, but I dont know javascript, This my code:
Code:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form action="DeleteNumber.php" method="post" name="form1">
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("calls", $con);
//Hago query1 selecciono el Departamento a buscar
$query1 = "SELECT * FROM numberlist ".
"ORDER BY number ";
$result1 = mysql_query($query1) or die(mysql_error());
/* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */
//$result = mysql_query ($query);
echo "<select name='number'>";
// printing the list box select command
while($row1=mysql_fetch_array($result1)){//Array or records stored in $nt
//echo "<option value=>$row1[departamento]</option>";
echo"<option value='$row1[number]'>$row1[number]</option>";
/* Option values are added by looping through the array */
}
// printing the list box select command
echo "</select>";// Closing of list box
?>
<label>
<input type="text" name="textfield" value="" />
</label>
<input name="submit" type="submit" id="submit" value="Submit" />
</form>
</body>
</html>
[/color]