Hi All,
I am very new to PHP and still learning lots... :)
I am using the below code to populate a drop down list from my database.
But I am not sure how to display/send the results back to the same page.
The fields in my Database are:
Base, Owner, Cluster, Sector, Coordinates, Defenses, Notes
So based on the code below - when someone selects their Cluster I would like to display all records from database that are from that cluster. Any help is greatly appreciated.
Here is code I have:
<?php
//Populates drop down choice from database field
//Database connection string is here.
$query = "select DISTINCT Cluster FROM Starbase";
$results = mysql_query($query, $link) or die("Error performing query");
if(mysql_num_rows($results) > 0){
echo("<select name=\"selectItem\">");
echo '<option value="">Please Select..</option>';
while($row = mysql_fetch_object($results)){
echo("<option value=\"$row->record_id\">$row->Cluster</option>");
}
echo("</select>");
}
else{
echo("<i>No values found</i>");
}
?>