Jump to content

Recommended Posts

hey all,

 

i have a tricky problem that i can't get my head around.

 

i have a msql table that will populate a drop down menu, this is fine. I have another table that has a column that contains a number that i want to use to tell how many times the drop down menu should appear.

 

for example.

 

beach house has a drop down number of 8 (8 possible locations to place an option) -

 

so when i display my php page showing this row (using GET) it shows 8 drop down menus from the table drop down menu (all menus are the same) eg.

 

MENU: Window

Sliding Door

Entry Door

 

 

i'm totally lost on how to get the 8 from the beach house row to relate to the number of drop down menus.

without your current code theres nothing specific that can be given to you. a generic example would be along the lines of :

$count = $_GET['numOfMenus'];
$menuList = array();
$sql = "SELECT menuItems FROM menuTable WHERE targetValue = 'Beach House'";
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_assoc($result)){
 $menuList[] = $row['menuItems'];
}
for($i=0;$i<=$count;$i++){
 echo "<select name=\"menu{$i}\" id=\"menu{$i}\">"
 foreach($menuList as $menuItem =>$menuValue){
   echo "<option value=\"{$menuValue}\">{$menuValue}</option>";
 }
 echo "</select>";
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.