Var tvungen att vänta på att mitt konto skulle aktiveras.
Detta är hur jag skulle löst det:
fil1
Kod:
<a href="form.php?prechoice=Cars">Cars in the form</a>
fil2
Kod:
<?php
function optionSelect($strValue)
{
if(isset($_GET['prechoice']) && $_GET['prechoice'] != "") {
$pre = $_GET['prechoice'];
if($strValue == $pre) {
echo "selected";
}
}
else {
echo "Prechoice not set<br />";
}
}
?>
<form>
<select>
<option <?php optionSelect("Books"); ?>>Books</option>
<option <?php optionSelect("Cars"); ?>>Cars</option>
<option <?php optionSelect("Movies"); ?>>Movies</option>
</select>
</form>