Alright, here is a sample of the results I get after some revision to the query as you suggest.
Array ( [0] => Adams Twp [description] => Adams Twp [1] => 150008 [value] => 150008 )
Array ( [0] => Adamsburg [description] => Adamsburg [1] => 316002 [value] => 316002 )
Array ( [0] => Addison Boro [description] => Addison Boro [1] => 141001 [value] => 141001 )
Array ( [0] => Addison Twp [description] => Addison Twp [1] => 141002 [value] => 141002 )
Array ( [0] => Alcola [description] => Alcola [1] => 902005 [value] => 902005 )
Array ( [0] => Aleppo [description] => Aleppo [1] => 104005 [value] => 104005 )
Array ( [0] => Aleppo [description] => Aleppo [1] => 560506 [value] => 560506 )
I think, as you can see with the repeat 'Aleppo', this is why GROUP BY should be kept in, since Aleppo appears to have different area values. (For this purpose, I only want one result for Aleppo, where later I can write a query getting all values for Aleppo.) Actuially, this suggests a potential problem, so I revised this query.
//gets listing of areas for Detailed Search when doing listings search
$query_area_search = 'SELECT DISTINCT(a.description)'
. ' FROM areas a'
. ' WHERE a.value>0'
. ' GROUP BY a.description'
. ' ORDER BY a.description ASC';
$result_area_search = mysql_query($query_area_search);
while ($row_area_search = mysql_fetch_array($result_area_search)) {
echo "<option value=\"".$row_area_search['description']."\"";
if(in_array($row_area_search['value'], $_POST['areas'])) {
echo " selected";
}
echo ">".$row_area_search['description']."</option>\n";
}
RESULT:
Array ( [0] => Adams Twp [description] => Adams Twp )
Array ( [0] => Adamsburg [description] => Adamsburg )
Array ( [0] => Addison Boro [description] => Addison Boro )
Array ( [0] => Addison Twp [description] => Addison Twp )
Array ( [0] => Alcola [description] => Alcola )
Array ( [0] => Aleppo [description] => Aleppo )
Array ( [0] => Aliquippa [description] => Aliquippa )
And here is the print_r of the form field 'areas' I get in the following code:
<div class="row">
<?php
mysql_free_result($result_area_search);
$resulttest = mysql_query($query_area_search);
while ($row2 = mysql_fetch_array($resulttest)) {
print_r($row2);
echo "<br />";
}
echo "<p />";
print_r($_POST['areas']);
?>
</div>
RESULT:
Array
I don't understand why I don't get anything from the $_POST of the 'areas' when selecting elements?