mysq_hell Posted January 24, 2006 Share Posted January 24, 2006 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 ColourRight 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. Quote Link to comment https://forums.phpfreaks.com/topic/3251-newbie-here-need-help-with-pull-down-dynamic-menus/ Share on other sites More sharing options...
mysq_hell Posted January 24, 2006 Author Share Posted January 24, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/3251-newbie-here-need-help-with-pull-down-dynamic-menus/#findComment-11092 Share on other sites More sharing options...
marcon3001 Posted July 26, 2006 Share Posted July 26, 2006 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"> <?phpdo { ?><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 Quote Link to comment https://forums.phpfreaks.com/topic/3251-newbie-here-need-help-with-pull-down-dynamic-menus/#findComment-64085 Share on other sites More sharing options...
carlostau Posted August 11, 2006 Share Posted August 11, 2006 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, colourfrom your_table where trainer='trainer' and colour like 'colour'Both 'triner' and 'colour' will be replaced with what you had in the formWorks like a charm!Good luckDemian[quote author=mysq_hell link=topic=84179.msg339614#msg339614 date=1138144253]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.[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/3251-newbie-here-need-help-with-pull-down-dynamic-menus/#findComment-73298 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.