Re: Re: Generating an option list with a default

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

 



On 2/11/2014 12:54 PM, Jim Lucas wrote:
On 02/11/2014 08:55 AM, Jim Giner wrote:
On 2/11/2014 11:26 AM, Jim Lucas wrote:
On 02/11/2014 05:59 AM, Jim Giner wrote:
On 1/25/2014 3:45 PM, Jennifer wrote:
Hello all,

    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!

Thank you,
Jenni

    Superior Shelving Systems::::....
    http://www.SuperiorShelving.com

    The (Storage|Office|Home|Warehouse) Shelving Specialists
    Since 1984

Wire LAN Shelving:
http://www.superiorshelving.com/mfg/nexel/pages/wire-shelving-chrome.php



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.


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.

The OP's original idea was that any specific page have a specific
option in
mind as the default to be selected when going to the central 'list'
page.  It
is not meant to be the user's option, but the intermediate page's.  If
the
user did however go directly to the list page, then there is no default.


Ok, I understand that.  But, lets say that I browse one page that has a
default, then another that has a default, each time doing so would
update that session variable.  Now, I go to a page that doesn't
have/need a default  but from there I click the link that takes me to
the page with the form.  Now, if I didn't clear the session variable on
that last page that didn't have a default, then it would use the value
set on the previous page instead of not having a default.

So - simply have the list-generator page unset the var.

--
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