I am editing a site that already exists, so I have to work with the code they already generated. So far..so good. I have a problem with the drop down box though. The site is for a car dealership, so they have "new" and "used" cars. The database that they send me has "N" and "U" for those items. I have been able to change it to print "New" and "Used" on the page as needed. My problem is a sort box. It is a dynamic drop down list. No matter what I have put in there, I still get all 5 options printing. "All, N, New, U, Used".
This is the original code:
<td width="142" style="font-family: Arial; font-size: 8pt; color: #000000; font-weight: bold">
<p style="text-align: right">
<b>View All - New - Used</td><Form name="qs_search_form" method="post" action="./usedcars_frontstore.php">
<input name="sortfield" type="hidden" value="<?php print qssession("usedcars_frontstore_sortfield"); ?>">
<input name="sortby" type="hidden" value="<?php print qssession("usedcars_frontstore_sortby"); ?>">
<?php
if (($SESSION["usedcars_frontstore_search_fd10"] == "") || ($SESSION["usedcars_frontstore_search_fd10"] == "")) {
$itemvalue = "";
} else {
$itemvalue = $_SESSION["usedcars_frontstore_search_fd10"]; $iopt = substr($itemvalue, 0, 2);
if ($iopt == "==") {
$itemvalue = substr($itemvalue, 2);
}
}
$cellvalue = "<select name=\"search_fd10\" onChange=\"this.form.submit();\">";
$cellvalue .= "<option value=\"\"" . qscheckselected("","*","selected") . ">All</option>";
$cellvalue .= qsmysqlgen_listbox(" Select Distinct Condition,Condition From inventory Order by Condition","listbox_category","Condition","Condition",$itemvalue) . "</select>";
$cellvalue .= "<input type=\"hidden\" name=\"multisearch_fd10\" value=\"\">";
if ($cellvalue == "") {
$cellvalue = " ";
}
?>
<td align=left width="15"> <?php print $cellvalue; ?>
</td>
Their coding isn't the best, but I have to work with it.
I have tried:
<td align=left width="15"> <?php
if ($cellvalue == "N")
{
$cellvalue = "New";
}
elseif ($cellvalue == "U")
{
$cellvalue = "Used";
}
else
{
print $cellvalue;
} ?>
</td>
but I think it is too late in the code to change it there. I tried changing it to:
$cellvalue .= "<input type=\"hidden\" name=\"multisearch_fd10\" value=\"\">";
<td align=left width="15"> <?php
if ($cellvalue == "N")
{
$cellvalue = "New";
}
elseif ($cellvalue == "U")
{
$cellvalue = "Used";
}
else
{
print $cellvalue;
} ?>
</td>
<td align=left width="15"> <?php print $cellvalue; ?>
</td>
It still does not get rid of the "N" and "U" in the drop down box. I am sure it is something simple, but I cannot figure it out. Thanks for any help.