Thank you, Peter.
I made 3 changes to this code:
conn = dbconnect
foo = short_name
footable - durham_person
Ran the code -- it does work -- but take a look at the result. How do I make those "n" characters go away?
Also, I don't know what "n" represents in the code.
Live script here:
https://database39.com/testo.php
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script type='text/Javascript'>
function submit( f ) {
f.submit();
}
</script>
</head>
<body>
<form>
<?php
// Database connection data
$servername = "mysql503.discountasp.net";
$dbuser = "xxxxxxxxx";
$dbpasswrd = "xxxxxxxxx";
$dbname = "MYSQL5_1020784_database39";
// Create connection
$dbconnect = mysqli_connect($servername, $dbuser, $dbpasswrd, $dbname);
// Check connection
if (!$dbconnect) {
die("Connection failed: " . mysqli_connect_error());
}
$resfoo = mysqli_query( $dbconnect, "SELECT short_name FROM durham_person" ) or die( "Cannot retrieve foo values" );
echo "<b>Foo Value:</b> n";
echo " <select name='short_name' onChange='submit(this.form)'>n";
while( $row = mysqli_fetch_row( $resfoo )) {
$sel = ( $table === $row[0] ) ? "id='sel' selected" : "";
printf( " <option %s value='%s'>%s</option>n", $sel, $row[0], $row[0] );
}
echo " </select>n";
echo " <input id='edit' type='button' value='Pick a foo' onClick='submit(this.form)'>n";
?>
</form>
</body>
</html>