PDA

View Full Version : Where would I put this code to make drop down menu's be selected a certain option...


AutomatikStudio
01-30-2004, 03:37 AM
Okay...didn't know what else to name this thread...so let me explain. I have some drop down menu's in Edit Profile in the User CP that have drop down menu's. The user selects what they want from the drop down menu and then submit's it to the database. Now...when the user returns to Edit Profile I'd like those drop down menu's to be selected with what they chose. Either way...I have the code I need to do it...just don't know what file and where to put it. The Birth Date drop down menus in Edit Profile are prime examples of what I'm trying to do.

Natch
01-30-2004, 03:57 AM
I think I get your question ...

<select ...
<option selected="selected" value="currentvalue">Current Name</option>


Right ?

So you need to


$current ($currentvalue === $userchosenoption) ? "selected='selected'" : "";


and then

<option $current value="currentvalue">Current Name</option>


in each iteration of your array of possible values ...

Make any sense ?

AutomatikStudio
01-30-2004, 04:03 AM
Right...I know "how" to do it...thats not the question...the question is where to put my piece of code....in other words...where would i put the "$current....."

Natch
01-30-2004, 04:20 AM
in includes/functions_user.php I would have thought ...

AutomatikStudio
01-30-2004, 05:17 AM
Well...after looking through the hundreds of lines of functions_user.php...I agree that that is where it would go....but I still can't figure out where....

Natch
01-30-2004, 12:37 PM
Do you have a separate function you have written to handle your dropdown menu ?

AutomatikStudio
01-30-2004, 01:24 PM
I do not.

Natch
01-30-2004, 02:03 PM
Ahhhh - ok so you wanna use the Extra Options facility and add your own test for $current pet ... sorry I had my general query brain in, not my specific query brain LOL

2 secs ... BRB ...

.........

Looking at the function verify_profilefields($formtype = 0), it look slike it should work for custom profile fields just as well as the default ones ... how have u configured your custom field ?

AutomatikStudio
01-30-2004, 02:06 PM
Well I haven't used any of the actual custome fields. I just have my new form elements w/ drop down menus and they are named "pettype" and "petgender"...

Natch
01-30-2004, 02:08 PM
rite - well as NTLDR has said - https://vborg.vbsupport.ru/showpost.php?p=470884&postcount=16 - you need to globalise your _POST variables for them to get down into the functions, but why not use a custom field - that way you just need tu extrapolate data from the user table ?

AutomatikStudio
01-30-2004, 02:13 PM
rite - well as NTLDR has said - https://vborg.vbsupport.ru/showpost.php?p=470884&postcount=16 - you need to globalise your _POST variables for them to get down into the functions, but why not use a custom field - that way you just need tu extrapolate data from the user table ?Well there is 1 actual field, and 2 drop down menus. And I'm not REAL familiar with using the whole custom field thing.

AutomatikStudio
01-30-2004, 07:19 PM
Also...this has to be replicable by other uses as this will be part of a hack...so it might not be very effecient to get other users to make lots of custom fields. And really...if I could just figure out how the "birthday" drop down menus get selected then I think I'd be fine...but I can't seem to find it anywhere.