Thread: Preselecting form elements
Results 1 to 2 of 2
Block elements within inline elements Forum: CSS ForumReplies: 6
Indenting Text in Form Elements Forum: CSS ForumReplies: 4
tekno elements Forum: Show it off!Replies: 7
07-16-2009, 04:13 AM #1
Preselecting form elements
Wasn't sure where to post, not sure which language (or combination of languages), this will require.
I have 2 pages, one of the pages has a form.
I'd like to click a link on one page, and when the page with the form loads, one of the options to be preselected according to a parameter from the original page.
Even suggestions of what I should look into would be helpful.
(Both pages are built using php)
07-17-2009, 05:26 PM #2
Re: Preselecting form elements
If you are familiar with passing variables via the URL, then this should be relatively simple for you.
As an example, if you have the following link:
<a href="nextpage.php?one=choices">Next Page</a>
$selection = $_REQUEST['one'];
echo "<option value='one'".(($selection == 'one') ? " selected" : "").">One</option>";
echo "<option value='two'".(($selection == 'two') ? " selected" : "").">Two</option>";
echo "<option value='three'".(($selection == 'three') ? " selected" : "").">Three</option>";