Then what you want to do is something like the following:
On your form, where you have your selection, replace it with:
PHP Code:
<select name="location">
<option>PLEASE SELECT</option>
<?php
$type =$_GET['type'];
if ($type == "fml") {
echo '<option value="fml" selected>fml</option>';
}
else
echo '<option value="fml">fml</option>';
if ($type == "ftl") {
echo '<option value="ftl" selected>ftl</option>';
}
else
echo '<option value="ftl">ftl</option>';
if ($type == "kids") {
echo '<option value="kids" selected>kids</option>';
}
else
echo '<option value="kids">kids</option>';
?>
</select>
Save your form as a php file.
Now in the page that calls the form, for the links put:
<form>.php?type=fml
<form>.php?type=ftl
<form>.php?type=kids
depending on which option you want selected when the form is shown.
I've actually been working on something similar. Here is my page:
http://www.metadigm.co.uk/partners/websense/index.php
If you click on the "get a free quote" in the "resources" section you will notice that next to "Product" it states "Please State". Pretty much a normal form. However if you click on the £ icon under each product you will see that the drop-down automatically selects the correct product. This is all done in the same form using the method above.
And here's the code for that select:
PHP Code:
<select name="product">
<?php
$prod =$_GET['prod'];
if ($prod == "gen") {
echo '<option selected>Please state</option>
<option value="Websense in general">Websense in general</option>';
}
else
echo '<option>Please state</option>
<option value="Websense in general">Websense in general</option>';
if ($prod == "ent") {
echo '<option selected value="Websense Enterprise">Websense Enterprise</option>';
}
else
echo '<option value="Websense Enterprise">Websense Enterprise</option>';
if ($prod == "cpm") {
echo '<option selected value="Client Policy Manager">Client Policy Manager</option>';
}
else
echo '<option value="Client Policy Manager">Client Policy Manager</option>';
if ($prod == "wss") {
echo '<option selected value="Web Security Suite">Web Security Suite</option>';
}
else
echo '<option value="Web Security Suite">Web Security Suite</option>';
?>
</select>
Bookmarks