Re: Generating an option list with a default

From: Date: Tue, 11 Feb 2014 16:32:19 +0000
Subject: Re: Generating an option list with a default
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-322821@lists.php.net to get a copy of this message
On 01/25/2014 12:56 PM, Stephen wrote:
On 14-01-25 03: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!
You could code the links as a form with the link like a submit button and the default hard coded on each page.
Why a form? Just use an anchor tag. No need for a form/button. Well, I guess if you want to use a <button ..></button> element, you won't need a form.
Then on the product sample page check to see if the default is set, and if so, use it.
-- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/

« previous php.general (#322821) next »