Visa ett inlägg
Oläst 2011-02-16, 19:31 #7
Kekke Kekke är inte uppkopplad
Medlem
 
Reg.datum: Feb 2011
Inlägg: 198
Kekke Kekke är inte uppkopplad
Medlem
 
Reg.datum: Feb 2011
Inlägg: 198
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>
Kekke är inte uppkopplad   Svara med citatSvara med citat