<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?
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
}
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With