Re: Re: Generating an option list with a default
| From: | Jim Lucas | Date: | Tue, 11 Feb 2014 16:26:47 +0000 |
| Subject: | Re: Re: Generating an option list with a default | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322819@lists.php.net to get a copy of this message | ||
On 02/11/2014 05:59 AM, Jim Giner wrote:
On 1/25/2014 3:45 PM, Jennifer wrote:I see one issue with doing it this way. If a person visited a page that he didn't want to have a default for the form value, then he would have empty that session variable. So, not only are you setting a variable on each page you want it done on, you need to make sure that variable is erased/emptied on every page load that should not have a default. That to me is a headache waiting to happen. -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/Hello all,I had your thought in mind halfway thru your question. Of course that's the way to do it. So simple, flexible and easily implemented. Set a session var that your central piece of code checks as it builds the select list and you're all set.We have a PHP form with a static <option> list, where people can requesta product sample. http://www.superiorshelving.com/mfg/aigner/sample.phpThere are links on multiple pages that call this page. I would like tosend a different default option to that form from each of those pages so that the customer doesn't have to pop-up the list to choose it manually. Of course, if they go to that form directly, there shouldn't be a default.What would be the best way to handle this? I'm thinking to have codegenerate the list with the default undefined, and then have the links to that page pass a variable to the form to set a default. Does that sound like it would work?Any other ideas are appreciated!Thank you, JenniSuperior Shelving Systems::::.... http://www.SuperiorShelving.comThe (Storage|Office|Home|Warehouse) Shelving Specialists Since 1984Wire LAN Shelving: http://www.superiorshelving.com/mfg/nexel/pages/wire-shelving-chrome.php