【发布时间】:2015-05-31 18:50:33
【问题描述】:
我有一个应用程序,在第一页上,用户可以选择四种产品。在他保存数据后,我必须显示所有四种产品的列表,并在用户选择的产品旁边放置一个 "check"。我的逻辑有问题 - 谁能帮忙?
// 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 that the user selected from the $selected_products string.
}
【问题讨论】:
-
嗨@runningmark,如果这个或任何答案已经解决了您的问题,请点击复选标记考虑accepting it。这向更广泛的社区表明您已经找到了解决方案,并为回答者和您自己提供了一些声誉。没有义务这样做。