How can I get an array like this
index.php?jenis=11,12,13
or like this without remove the previous value?
index.php?jenis=11&jenis=12&jenis=13
In my code wherever I do a click or an action it just get the next $_GET
value but not keep the previous $_GET
value. The question is how I can keep both previous $_GET
and next $_GET
into one?
Here is my code:
HTML:
<form id="filter">
<label>Pertama </label>
<ul>
<li><input type="checkbox" onclick="jeniss();" name="jenis" value="11" <?php if ($jenis == "11") { echo "checked"; } ?> > <a> 11 </a> </li>
<li><input type="checkbox" onclick="jeniss();" name="jenis" value="12" <?php if ($jenis == "12") { echo "checked"; } ?> > <a> 12 </a> </li>
<li><input type="checkbox" onclick="jeniss();" name="jenis" value="13" <?php if ($jenis == "13") { echo "checked"; } ?> > <a> 13 </a> </li>
</ul>
</form>
PHP:
if (!isset($_GET['jenis'])) {
$jenis = "";
} else {
$jenis = $_GET['jenis'];
}
Javascript:
<script>
function jeniss(){
document.getElementById('filter').submit();
}
</script>
Note : I'm using javascript so every action (check or uncheck) will redirect into new page which is my hope result. Thank you for helping.