How to store selected multiple checkbox values in an array in php? -


<input type="checkbox"name="travel[]" value="bus"/> <input type="checkbox"name="travel[]" value="train"/> <input type="checkbox"name="travel[]" value="plane"/> foreach($_post['travel']as $selected)   var select[]=$selected; 

if user selects 3 checkboxes, have store them in array , send mail dont have data base. how should store them in array?

foreach($_post['travel']as $selected) var select[]=$selected; 

the above code returning last selected check box , how should pass , display on mail?

instead of

foreach($_post['travel']as $selected) var select[]=$selected; 

update to

$select = array(); foreach($_post['travel'] $key => $selected){     $select[$key]=$selected; } 

instead of using foreach use $select = implode(',',$_post['travel']);


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -