Hello - I am trying to display a select entry page using this code
<?php
//connect to database
$mysqli = mysqli_connect("sql8.bravehost.com", "username", "password", "BHAA-1006921");
if (!$_POST) {
//show form
$display_block = "<h1>Select an Entry</h1>";
//get parts of records
$get_list_sql = "SELECT id,
CONCAT_WS(', ', p_l_name, p_f_name) AS display_name
FROM enroll ORDER BY p_l_name, p_f_name";
$get_list_res = mysqli_query($mysqli, $get_list_sql)
or die(mysqli_error($mysqli));
if (mysqli_num_rows($get_list_res) < 1) {
//no records
$display_block .= "<p><em>Sorry, no records to select!</em></p>";
} else {
//has records, get results and print in a form
$display_block .= "
<form method=\"post\" action=\"".$_SERVER["SCRIPT_FILENAME"]."\">
<p><strong>Select a Record to View:</strong><br/>
<select name=\"sel_id\">
<option value=\"\">-- Select One --</option>";
While ($recs = mysqli_fetch_assoc($get_list_res)) {
$id = $recs['id'];
$display_name = stripslashes($recs["display_name"]);
$display_block .= "<option value=\"".$id."\">".
$dislpay_name."</option>";
}
$display_block .="
</select>
<p><input type=\"submit\" name=\"submit\"
value=\"View Selected Entry\"></p>
</form>";
}
When I try to select a record my data is not displayed, if I move the mouse over a record it is highlighted and I can view the entry. I am making the connection and getting the data, it is just not showing up in the list.
Thank you in advance.