The page shows descriptions for a range of subjects, and currently visitors can click on a button beneath each description to request further information on that subject – this is a simple hyperlink, which takes them through to the form, where they can select their subject of interest from a dropdown list.
I’d like to have visitors click on the button associated with a particular subject, and, instead of simply being passed to the web form – and here’s the science – for the dropdown list selection on the form to be already populated with the subject that they selected on the previous page.
So my question(s) would be, is this achievable, and would anyone be able to advise on where to look in order that I can start working on this?
Hope this is OK, but thanks for any and all information in advance, and apologies for any inconvenience.
The approach I use is pas the value in the query string: ie form.php?field=subject_name
Then to select the default value:
$selected['$_GET['field']']=' selected="selected" ';
Any other value of the array is null
Then in the select:
<select id="subject_name" <?=$selected['subject_name']?>
<select id="Auto" <?=$selected['Auto']?>
This method avoids using a ton of very sloppy if statements.
Ah! Thanks so much for your response, eruna - I very much appreciate it.
If anything, I think what I'm looking to do with this function is a kludge in the first place. My original plan was to use a checkbox list, but because of issues with the backend I'm having to use a dropdown list.
Bah! Back to the drawing board... But thanks very much again for your response - it's been of considerable help.