i have the following select in my code. now it posts the whole value to the next page, but how can i pass the variable $dagen to the next page?
<form method="post" action="pagina4.php?lang=<?=$_SESSION['lang'];?>&naam=<?=$naam;?>&fietskeuze=<?=$fietskeuze;?>&opties=<?=$opties;?>&optieid=<?=$optieid;?>">
<select id="dagen" name="dagen" style="width:250px;" style="height:250px;">
<?php
$query="SELECT * FROM $tabel WHERE fietstype='$fietskeuze'";
$result=mysql_query($query) or die ("Ophalen prijzen mislukt: ".mysql_error());
while ($row=mysql_fetch_array($result)) {
$dagen=$row[dagen];
$prijs=$row[prijs];
echo "<option>
$dagen ".$lang['pagina3_dag']." - Tarief: EUR ".$prijs."
</option>";
}
You already are. Some of your variables are available in $_GET
(the query string of the action attribute), but the dagen
variable will be available in $_POST['dagen']
.
If the complete string is not what you want, you can add a value attribute to get just your $dagen
variable:
echo "<option value="<?php echo $dagen; ?>">
...