我被一件小事困住了。
我在一个表单中有两个选择下拉框。但是现在当我选择年份然后月份时,我失去了选定的年份,我知道为什么我失去了年份。因为我已经在脚本onChange
中设置了javascript:document.location
我试图把它放在$_GET['jaartal'];
里面但它不起作用。
有人可以帮我解决这个问题吗?
这是脚本。
<?php
//Including config and connection file
include_once '..\config\config.php';
include_once '..\config\inc_connect.php';
//Retrive month value from url and put in variable
$maand = ViewDatumArray();
//Retrive typ value from url and put in variable
$verwerking = $_GET['type'];
$vast_verwerking = $verwerking;
// Years range setup
//$kayako_start = 2012;
?>
<!DOCTYPE html PUBLIC "XHTML 1.0 Transitional" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<script type="text/javascript" src="../config/function.js"></script>
<link rel="stylesheet" href="../config/style.css" type="text/css">
</head>
<body style="background-color:#F8F4EB">
<div style="width:900px; margin:0px auto;">
<input type="button" value="Ga Terug" class="goBackJS" onClick="goBack()"/>
<br/>
<!-- 02-01-2013 Added function for year instead -->
<span>Kies de Jaar / Maand van overzicht dat je wilt downloaden.</span>
<form action="" method="post">
<select class="dropstyle" name="jaartal" onChange"<?php $jaar_keuze = $jaar?>">
<option value="2012" selected>Kies jaartal</option>
<?php // Generate the years from start kayako until now.
foreach (range($jaar_nummer = date("Y"), 2012) as $jaar) { ?>
<option value="<?php echo($jaar); ?>" selected><?php echo($jaar); ?></option>
<?php
}
?>
</select>
</form>
<?php echo $jaar_keuze; ?>
<form action="" method="post">
<select class="dropstyle" name="maand" onChange="javascript:document.location='class.View_Evident_Download.php?type=<?php echo $vast_verwerking; ?>&jaar=<?php $_GET['jaartal']; ?>&maand=' + this.value">
<?php
foreach ($maand_teksten as $keyvalue => $waarde) { ?>
<option value="<?php echo $keyvalue; ?>"><?php echo $waarde;?></option>
<?php
}
?>
</select>
</form>
<?php
if(!empty($maand)){
$maand_gekozen = $maand[0];
//Functies voor eerste en laatste dag van de maand
$jaardag = eersteDagVanMaand();
$jaareind = laatsteDagVanMaand();
echo "<br/>";
if ($maand_gekozen < "1"){
echo "Kies maand om te downloaden.";
} else {
if(isset($_GET['type']))
{
$type_download = $_GET['type'];
$jaar_nummer = $_GET['jaartal'];
echo $type_contract[$type_download] . ' van <b>' . $maand_teksten[$maand_gekozen] . $jaar_keuze . '</b> staat klaar om gedownload te worden.<br/>';
echo '<input style="width:300px;" type="button" onClick="location.href = \'class.Controller_Evident_Download.php?type=' . $type_download . '&maand=' . $maand_gekozen . '&jaar=' . $jaar_gekozen . '\';" class="goBackJS" value="Download ' . $type_contract[$type_download] . '"';
};
}
echo "<br/>";
echo "<br/>";
}
?>
<br/>
</div>
</body>
</html>