| | |||||
| ||||||||
| CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Aug 2005 Location: Uk, South Yorkshire
Posts: 1,225
![]() ![]() ![]() ![]() ![]() ![]() ![]() | Pre-Populating Dropdown's Hey, Thought i'd post some code. It's not a big piece of code, but very useful. In some scripts, it's annoying when you are editing a MySql (For Example) Entry, and it has some dropdown menu's, lets say, Forum Leader -- Adrian -- Hitch -- xD -- Jake Right, so, when we edit that form, we sometimes get the Dropdown List in that order ^, though, what if we have already assigned Hitch to that forum, and we are editing the Forum Name. Everytime we click submit, we are gonna have to check if the FL dropdown is set the user we want. It can get very annoying, anyway, this will automatically select the current FL as the Default option... Ok, that may have being a bit hard to understand? ^ Anyway, here's the code. When i use terms such as user, it's meant as a example. So, list all the users, and set the current FL as default, according to the Forum Table. PHP Code: So, you have 4 options, and you want to Pre-Populate them? Do the following, PHP Code: I made a quick function for the Static Dropdown Menu's. PHP Code: PHP Code: ![]() Don't forget about the little things. Oh, and i don't want any moaning about the queries, they were just examples, so no "Why not use JOINS?" ![]() Adrian
__________________ Cueburst - Support System - FAQ Knowledge Base, Tickets and more. |
| |