Please look at my code below. I am new to php and this is driving me crazy. The code does not insert the value of the variable name $district_id, it only displays the variable name itself.
I am trying to create a list of districts as clickable links and pass the district_id (thru the url) to the next page for database modification or deletion.
<?php
$connection = mysql_connect(blah, blah, blah) or die ("Couldn't connect to server");
$db = mysql_select_db(blah, $connection) or die ("Couldn't select database");
$sql = "select county_id, county_name from county";
$sql_result = mysql_query($sql,$connection) or die ("Couldn't execute county query");
while ($row = mysql_fetch_array($sql_result)) {
$county_id = $row["county_id"];
$county_name = $row["county_name"];
$option_block .= "<option value=\"$county_id\">$county_name</option>";
}
$sql2 = "select district_id, district_name from district
order by district_name";
$sql_result2 = mysql_query($sql2,$connection) or die ("Couldn't execute district query");
while ($row = mysql_fetch_array($sql_result2)) {
$district_id = $row["district_id"];
$district_name = $row["district_name"];
$display_block .= '<a href="http:/district_modify.php3?district_id=$district_id">$district_name</a><br>';
}
?>
Thank you in advance for your help.
Mark