hai there,
please someone help me, i'm not really good on coding.
is there a way i can send form variable to the sql query on the module.
i mean is i want user to be able to select what month and year of data they want to view and do it using form month and year dropdown menu i made, they submit the request and the tables comeup with the result.
i have this for the form, but i wonder how and where to put it
Code: |
<h1 align="center" >peserta kb aktif</h1>
<form action="tabel.php" method="post">
Bulan
<?php
$curr_month = date("m");
$month = array (1=>"Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember");
$select = "<select name=\"bulan\">\n";
foreach ($month as $key => $val) {
$select .= "\t<option val=\"".$key."\"";
if ($key == $curr_month) {
$select .= " selected=\"selected\">".$val."</option>\n";
} else {
$select .= ">".$val."</option>\n";
}
}
$select .= "</select>";
echo $select;
?>
Tahun
<select name="tahun">
<?php
$mulai= date('Y') - 5;
for($i = $mulai;$i<$mulai + 20;$i++){
$sel = $i == date('Y') ? ' selected="selected"' : '';
echo '<option value="'.$i.'"'.$sel.'>'.$i.'</option>';
}
?>
</select>
<input type="submit" value="Kirimkan"/>
</form>
|
on my normal html form i used to capture the value submitted with
Code: |
<?php
$bulan=trim(strip_tags($_POST['bulan']));
$tahun=trim(strip_tags($_POST['tahun']));
?>
|
and use that $bulan and $tahun variable on the mysql query.
i really stuck on this, any help will be apreciated.
sorry for my bad english,
regards.
Mo.