Re: Multiple values in a form option field

From: Date: Thu, 13 Nov 2003 21:41:43 +0000
Subject: Re: Multiple values in a form option field
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-169586@lists.php.net to get a copy of this message
Jeff, et al -- ..and then Jeff McKeon said... % % I have a php page that has a web form on it. Yay! Yippee! That's great! Oh, that's not the substantive body of your note? :-) % % I do a query to populate the options in a drop down box in the form. % .. % So when the user selects an email addres from the drop down box, the % userID is stored and later writen to a database. Right. % % What I now need to do is store not only the userID but the email address OK. % as well. Is there a way using a form to store 2 values using one drop Well, yes and no. You can store only one value in a field, but that value can be anything you want it to be. % down box? So basically I want to store the userID and the Email address % to a variable in the form so that both may be written to different % fields in the database later. If I were going to do this (and I've done a bit like it), I would first make an array of everything to be sent, then serialize it, and finally base64_encode it and use that as the value. When you get it on the other side, just decode and then unserialize and you have your array back to use as you wish. This works for large numbers of vars as well as just a few. % % Jeff HTH & HAND :-D -- David T-G * There is too much animal courage in (play) davidtg@justpickone.org * society and not sufficient moral courage. (work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

« previous php.general (#169586) next »