下拉列表对用户禁用,仅对管理员工作正常,但是当我编辑页面并重新提交时,它会在DB
中将特定列留空。
<select class="form-control" name="currency[]" <?php if($_SESSION['info'] == staff){ echo 'disabled="true"'; } ?>>
<option value="INR"<?php if ($row[currency] == 'Rs') echo ' selected="selected"'; ?>>Indian Rupee</option>
<option value="USD"<?php if ($row[currency] == 'USD') echo ' selected="selected"'; ?>>US Dollar</option>
<option value="CNY"<?php if ($row[currency] == 'cny') echo ' selected="selected"'; ?>>Chinese Yuan</option>
<option value="HKD"<?php if ($row[currency] == 'hkd') echo ' selected="selected"'; ?>>Hongkong Dollar</option>
<option value="TWD"<?php if ($row[currency] == 'twd') echo ' selected="selected"'; ?>>New Taiwan Dollar</option>
<option value="AUD"<?php if ($row[currency] == 'aud') echo ' selected="selected"'; ?>>Australian Dollar</option>
<option value="SGD"<?php if ($row[currency] == 'sgd') echo ' selected="selected"'; ?>>Singapore Dollar</option>
<option value="CHF"<?php if ($row[currency] == 'chf') echo ' selected="selected"'; ?>>Swiss Franc</option>
<option value="EUR"<?php if ($row[currency] == 'eur') echo ' selected="selected"'; ?>>Euro</option>
<option value="GBP"<?php if ($row[currency] == 'gbp') echo ' selected="selected"'; ?>>British Pound Sterling</option>
<option value="MYR"<?php if ($row[currency] == 'myr') echo ' selected="selected"'; ?>>Malaysian Ringgit</option>
<option value="NZD"<?php if ($row[currency] == 'nzd') echo ' selected="selected"'; ?>>New Zealand Dollar</option>
答案 0 :(得分:0)
<option value="INR"<?php if ($row[currency] == 'Rs') echo ' selected="selected"'; ?>>Indian Rupee</option>
值INR和Rs不匹配。
答案 1 :(得分:0)
<select class="form-control" name="currency[]" <?php if($_SESSION['info'] == staff){ echo 'disabled="true"'; } ?>>
<option value="INR"<?php if ($row[currency] == 'INR') echo ' selected="selected"'; ?>>Indian Rupee</option>
<option value="USD"<?php if ($row[currency] == 'USD') echo ' selected="selected"'; ?>>US Dollar</option>
<option value="CNY"<?php if ($row[currency] == 'cny') echo ' selected="selected"'; ?>>Chinese Yuan</option>
<option value="HKD"<?php if ($row[currency] == 'hkd') echo ' selected="selected"'; ?>>Hongkong Dollar</option>
<option value="TWD"<?php if ($row[currency] == 'twd') echo ' selected="selected"'; ?>>New Taiwan Dollar</option>
<option value="AUD"<?php if ($row[currency] == 'aud') echo ' selected="selected"'; ?>>Australian Dollar</option>
<option value="SGD"<?php if ($row[currency] == 'sgd') echo ' selected="selected"'; ?>>Singapore Dollar</option>
<option value="CHF"<?php if ($row[currency] == 'chf') echo ' selected="selected"'; ?>>Swiss Franc</option>
<option value="EUR"<?php if ($row[currency] == 'eur') echo ' selected="selected"'; ?>>Euro</option>
<option value="GBP"<?php if ($row[currency] == 'gbp') echo ' selected="selected"'; ?>>British Pound Sterling</option>
<option value="MYR"<?php if ($row[currency] == 'myr') echo ' selected="selected"'; ?>>Malaysian Ringgit</option>
<option value="NZD"<?php if ($row[currency] == 'nzd') echo ' selected="selected"'; ?>>New Zealand Dollar</option>