Hello, community. I'm a beginner in Osclass and PHP. Please I need your help.
I'm trying to create a footer menu based on the selection of cities or regions in descending order of the number of items.
One part of the code displays the selection based on cities, and the other part of the code displays the selection based on regions.
Each of the two parts of the code works if I add them to the page one at a time.
If I add them at the same time, the second code displays white (blank) entries.
Where did I make the mistake? Thank you very much.
<?php $cities = CityStats :: newInstance()->listCities('%%%%', '>', 'i_num_items DESC'); ?>
<?php $i = 1; ?>
<select name="sCity" id="sCity" onchange="this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);">
<option value="">Select a city</option>
<?php foreach($cities as $c) { ?>
<?php if($i <= 30) { ?>
<option value="<?php echo osc_search_url(array('page' => 'search', 'sCity' => $c['city_id']));?>"><?php echo $c['city_name'];?> (<?php echo $c['items']; ?>) </option>
<?php $i++; ?>
<?php } ?>
<?php } ?>
</select>
<?php $regions = RegionStats :: newInstance()->listRegions('%%%%', '>', 'i_num_items DESC'); ?>
<?php $i = 1; ?>
<select name="sRegion" id="sRegion" onchange="this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);">
<option value="">Select a region</option>
<?php foreach($regions as $r) { ?>
<?php if($i <= 30) { ?>
<option value="<?php echo osc_search_url(array('page' => 'search', 'sRegion' => $r['pk_i_id']));?>"><?php echo $r['s_name']; ?> (<?php echo $r['i_num_items']; ?>)</option>
<?php $i++; ?>
<?php } ?>
<?php } ?>
</select>