我的刀片中有这个:
<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>
即使样品产品是一种物理商品,也应该是
我的代码有什么问题?
答案 0 :(得分:1)
使用双精度等于单精度==
<?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>