Being new to programing, I hope I can explain the problem I'm having.
From a PHP script that provides a name of a city for each pass through of the
while (!$recordSet1->EOF) loop, I need to create a HTML form option. I've being trying to use this...
echo '<option value="city">city</option>';
placed within the loop.
This works outside of the loop...
echo "<form method=\"POST\" action=\"/or/addons/featbyclass/addon.inc.php\">";
echo "City: <select name=\"city[]\" multiple>";
echo "<option value=\"example\"> example</option>";
echo "</select>";
echo "<input type=\"submit\" name=\"Order\">";
echo "</form>";
I need help getting this to work...
echo "<form method=\"POST\" action=\"/or/addons/featbyclass/addon.inc.php\">";
echo "City: <select name=\"city[]\" multiple>";
function cities_display_addon_link() {
global $conn, $config, $lang, $State,$title,$City1;
require_once($config['basepath'].'/include/misc.inc.php');
$misc = new misc();
$display .= "";
$count = 1;
$numcols = 1;
$sql1 = "SELECT listingsdbelements_field_value, count(*) as cityCount
FROM " . $config['table_prefix'] . "listingsdbelements, " . $config['table_prefix'] . "listingsdb
WHERE " . $config['table_prefix'] . "listingsdbelements.listingsdb_id = " . $config['table_prefix'] . "listingsdb.listingsdb_id
and listingsdb_active = 'yes'
and listingsdbelements_field_name LIKE 'city'
group by listingsdbelements_field_value ";
$recordSet1 = $conn->Execute($sql1);
if ($recordSet1 === false)
{
$misc->log_error($sql1);
}
while (!$recordSet1->EOF) {
$City = $recordSet1->fields[listingsdbelements_field_value];
$cityCount = $recordSet1->fields[cityCount];
$num_rows = $recordSet1->RecordCount();
$cnt = $num_rows;
$Link = "<a href='index.php?action=searchresults&city=$City'>" . $City . " (" . $cityCount . ")</a>";
if ($count % $numcols == 0 )
{
$display .= "<li class=group>" . $Link . "</li>";
}
// ... This is the problem I'm having
echo "<option value=\"example\"> example</option>";
$count++;
$recordSet1->MoveNext();
}
return $display;
}
echo "</select>";
echo "<input type=\"submit\" name=\"Order\">";
echo "</form>";
?>
The output produced is displayed below the form...
example example example example example example example example
instead of populating the form with ...
example
example
example
example
example
example
example
example
I hope there's help for this newbie out there somewhere.
Thanks