How to $_GET multiple checkbox values?
checkbox, get, html, php
Solution
HTML:
<input type="checkbox" name="currency[]" value="usd"/>
<input type="checkbox" name="currency[]" value="euro"/>
<input type="checkbox" name="currency[]" value="cad"/>
PHP:
<?php
foreach($_GET['currency'] as $currency){
echo $currency."<br/>";
//or what ever
}
?>
Problem
``` <input type="checkbox" name="currency" value="usd"/> <input type="checkbox" name="currency" value="euro"/> <input type="checkbox" name="currency" value="cad"/> ``` Im trying to get currency values through $_GET request, something like `/?currency=usd,cad` but instead im getting `/?currency=usd¤cy=cad` and then `$_GET['currency']` returns only one value. adding `name=currency[]` just gets `/?currency[]=usd¤cy[]=cad` What is the proper way to get these checkbox values in some sort of array?