2 Dynamic Dropdowns : second is only filled a bit

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
asterinex
Forum Commoner
Posts: 52
Joined: Thu Nov 25, 2004 7:01 am
Location: Belgium

2 Dynamic Dropdowns : second is only filled a bit

Post by asterinex »

Hello Folks,
Hope someone can help me out. I have a table with +-4000 Postal codes en their cities. Now I have 2 dropdowns where people can searh between.
for exemple : give me all records between postal 1000 and 2000.
The problem is that the second dropddown has only a few postals with the same code. A memory Problem.

Code: Select all

$sql  = "SELECT * FROM postal_bel ORDER BY postal asc;";  
	    
$result1 = mysql_query($sql,$conn);
$numrows = mysql_num_rows($result1);
for ($i=0;$i<$numrows;$i++)
&#123;	
    $myrow = mysql_fetch_array($result1);
    $value_array&#1111;$i] = "<option value=".$myrow&#1111;'postal'].">".$myrow  &#1111;'postal']." ".$myrow&#1111;'city']."</option>";
 
 &#125;
mysql_free_result($result1);
?>

<select name="searchpostal1">
<?php 
 for ($i=0;$i<sizeof($value_array);$i++)
    echo $value_array&#1111;$i];
?>
</select>
//Dropdown 2 : Problem is only Filled a bit ?
<select name="2">
<?php 
 for ($i=0;$i<sizeof($value_array);$i++)
	echo $value_array&#1111;$i];
?>
</select>
Does anyone can help me ?

Thx in advance!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

do you have output buffering on? You may be able to save some memory by storing the options as a single string, instead of an array.
Post Reply