vendredi 27 mars 2015

how to generate checkbox from values user can select to values user selected

i've an application where user at first page shown 4 products which he can choose, now after he saves the data, i've to show list of all four products, and have to put check, which were saved by the user, i'm unable to crack the logic, would love if you could help



// user can choose from these products
$products = array('1'=>'Product One','2'=>'Product Two','3'=>'Product Three','4'=>'Product Four');
// user has choosen these products
$selected_products = explode(',', 'Product One,Product Four');
foreach($selected_products as $product)
{
// have to print out all products from $products variable, and check the ones user selected from the $selected_products string in checkbox html input type
}




Aucun commentaire:

Enregistrer un commentaire