[英]get value of item_type in database and make it selected in options
我的刀片中有这个:
<select class="form-control" id="item_type" name="item_type">
<option value="physical-goods" <?php if ($product->item_type="physical-goods") echo 'selected=" selected"'; ?>>Physical Goods</option>
<option value="digital-downloads" <?php if ($product->item_type="digital-downloads") echo 'selected=" selected"'; ?>>Digital Downloads</option>
<option value="credits" <?php if ($product->item_type="credits") echo 'selected=" selected"'; ?>>Credits</option>
</select>
即使样品产品是一种物理商品,也应该
我的代码有什么问题?
使用双等于等于单==
<?php if ($product->item_type`enter code here`=="digital-downloads") echo 'selected=" selected"'; ?>
<select class="form-control" id="item_type" name="item_type">
<option value="physical-goods" <?php if ($product->item_type=="physical-goods") echo 'selected=" selected"'; ?>>Physical Goods</option>
<option value="digital-downloads" <?php if ($product->item_type=="digital-downloads") echo 'selected=" selected"'; ?>>Digital Downloads</option>
<option value="credits" <?php if ($product->item_type=="credits") echo 'selected=" selected"'; ?>>Credits</option>
</select>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.