Hey Guys,
I build an array, which pulls its information from a database. Here is the code:
$querygrp = "SELECT DISTINCT RTRIM(GRP)as GRP
FROM TABLE
WHERE END_DATE = '".$daterange."'";
$ORIGRP = odbc_exec($db, $querygrp);
while (odbc_fetch_row($ORIGRP))
{
$filtergrp[] = (string)(trim(odbc_result($ORIGRP, "GRP")));
}
This works perfectly and reads in the correct values. I am using the $filtergrp array to populate a drop down box with this code:
echo "<select NAME =selectedgrp onChange='submit();'>";
echo "<option value = ''>SELECT VALUE</option>";
echo "<option value = 'ALL' ".($filtergrp=='ALL'? "SELECTED":"").">ORIG (ALL)</option>";
foreach($filtergrp as $g1)
{
if($g1 == $filtergrp)
{
echo "<option value = ".$g1." selected>".$g1."</option>";
}
else
{
echo "<option value = ".$g1.">".$g1."</option>";
}
}
echo "</select>";
echo "</td>";
This populates the drop down box perfectly with the correct values. The problem is when a value is selected in the drop down box it doesn't return the correct value for two word values, such as, New York. It would only return the value New. Im not really sure where the problem is, but it seems like a pretty easy fix. Im a newbie to php and programming in general so I probably left some helpful information out. If so just ask for any needed clarification.
I appreciate the help.