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

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -