Jump to content


Photo

Newbie Here... Need help with Pull Down Dynamic Menu`s


  • Please log in to reply
3 replies to this topic

#1 mysq_hell

mysq_hell
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 24 January 2006 - 09:55 PM

Hi, Im in the middle of writing an online catalogue for my Company and as an Exercise for me to learn More about PHP and Mysql etc.. All is working fine but i need a few Pointers if anyone can help..

1st Problem..
When my Form loads with the Dynamic Content it always shows tthe last record? I understand this is Normal, But from From all the Websites ive ever visted, ive never once seen this put into Practice? Most have a "please Choose" or a Name for the pull Down menu ie a Sports Site might have "Trainers" and then when you access the menu you see the trainers you can Choose?

2nd problem..
I have 2 Pull Down menus and 1 Submit button that Filters out the results from the Menus, Works Lovely, But it would be handy if you could Choose just One of the pull down menus and the 2nd one displayed all of the results from that Category.. let me give you an Example :-

Pull Down Menu 1 is Trainers Pull Down menu 2 is Colour

Right now you can Choose Nike and White from the Menus and press Submit and you see all White Nike trainers.. But what if i wanted to list all Nike Trainers? how can i Add an All Category to the Colour Menu? and Vise Versa?

Im Still Pretty New to PHP but have a Fairly Good Understanding as ive got this Far...

Thanks for Reading... Hope it made Sense...

Paul.

#2 mysq_hell

mysq_hell
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 24 January 2006 - 11:10 PM

Hi, Managed to Solve Problem One... Added Static menu item and Blanked out the Select value equal to Box..

Can anyone help with the SQL for problem 2, The Static Menu Options have a value of 0, Which Means if the Form is Submitted without Changing the Default value Nothing Happens...

Paul.

#3 marcon3001

marcon3001
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 26 July 2006 - 03:11 PM

Hey there,

I am having the same issue...also, when you create the pulldown dynamically, where is the selected value set to a variable??  Here is the code DreamW. creates for my pulldown:

<select name="select2">
          <?php
do { 
?><option value="<?php echo $row_rsFirstName['FirstName']?>"><?php echo $row_rsFirstName['FirstName']?></option>
          <?php
} while ($row_rsFirstName = mysql_fetch_assoc($rsFirstName));
  $rows = mysql_num_rows($rsFirstName);
  if($rows > 0) {
      mysql_data_seek($rsFirstName, 0);
  $row_rsFirstName = mysql_fetch_assoc($rsFirstName);
  }
?>
        </select>

rsFirstName being just a recordset of all the firstnames  in my database table.  I just need to know where the form variable is being set up there...???

-thanks

#4 carlostau

carlostau
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 11 August 2006 - 07:22 PM

HI!
Select your Dropdown, click on ListValues and add one Item Label called "All" or whatever you want to call it, now for the "All" thing to work, you have to assign a '%' Value (without the quotes) that way, when the form passes it, I will pass it as % and will work as a wildcard on your query. Lastly you have to modify the recordset query in your results page to use 'like' instead of '='

EXAMPLE:
Select trainer, colour
from your_table where trainer='trainer' and colour like 'colour'

Both 'triner' and 'colour' will be replaced with what you had in the form

Works like a charm!

Good luck
Demian

Hi, Managed to Solve Problem One... Added Static menu item and Blanked out the Select value equal to Box..

Can anyone help with the SQL for problem 2, The Static Menu Options have a value of 0, Which Means if the Form is Submitted without Changing the Default value Nothing Happens...

Paul.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users