Re: Generating an option list with a default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim Giner wrote:

> On 1/25/2014 3:45 PM, Jennifer wrote:
>>
>>     We have a PHP form with a static <option> list, where people can
>> request a product sample.
>>
>> http://www.superiorshelving.com/mfg/aigner/sample.php
>>
>>     There are links on multiple pages that call this page.  I would
>> like to send 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
>> code generate 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!
>
> 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.

Um, a session variable might not work for all visitors, unless they have
cookies enabled or the server is configured to pass the session ID in
the query string (what could not be viable for security reasons wrt.
sensitive information stored in the same session, and might not be
generally the best idea wrt. search engines).

Why not simply add the appropriate value as get parameter to the links?

-- 
Christoph M. Becker

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux