| FAQ |
| Kalender |
|
|
|
|
#1 | ||
|
|||
|
Supermoderator
|
Hehe, missuppfattade frågan lite grann
Vill du verkligen ha valet i url:en? Normalt är det snyggare utan tycker jag.
__________________
Full-stack developer, free for smaller assignments |
||
|
|
Svara med citat
|
|
|
#2 | ||
|
|||
|
Medlem
|
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> 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>
|
||
|
|
Svara med citat
|
| Svara |
|
|