我有以下代码:
<?php $radioSwitch = of_get_option('radio_switch');
if ($radioSwitch == "true") { ?>
<!-- radio switch -->
<div class="row switches clearfix">
<input type="radio" name="switch" id="switch1" value="<?php echo of_get_option('switch1'); ?>" /><label for="switch1" class="field"><?php echo of_get_option('switch1'); ?></label>
<input type="radio" name="switch" id="switch2" value="<?php echo of_get_option('switch2'); ?>" /><label for="switch2" class="field"><?php echo of_get_option('switch2'); ?></label>
</div>
<?php } ?>
................................................................................
<?php
$datePicker1 = of_get_option('datepicker1');
$datePicker2 = of_get_option('datepicker2');
if (($datePicker1 == "true") || ($datePicker2 == "true")) { ?>
<div class="row clearfix">
<?php if ($datePicker1 == "true") { ?>
<!-- datepicker 1 -->
<input type="text" id="dateFrom" name="<?php echo of_get_option('datepicker1_text'); ?>" value="<?php echo of_get_option('datepicker1_text'); ?>" tabindex="6" />
<label class="error" for="dateFrom" id="dateFrom_error">Selectați data.</label>
<?php } ?>
<?php if ($datePicker2 == "true") { ?>
<!-- datepicker 2 -->
<input type="textarea" id="dateTo" name="<?php echo of_get_option('datepicker2_text'); ?>" value="<?php echo of_get_option('datepicker2_text'); ?>" tabindex="7" />
<label class="error" for="dateTo" id="dateTo_error">Selectați data.</label>
<?php } ?>
</div>
<?php } ?>
如果是单选按钮&#34; switch1&#34;被选中,只有&#34; $ datepicker1&#34;必须是真的&#34; $ datepicker2&#34;必须是假的,如果单选按钮&#34; switch2&#34;被选中,&#34; $ datepicker1&#34;和&#34; $ datepicker2&#34;必须是真的。有人可以帮帮我吗?
答案 0 :(得分:0)
PHP是服务器端语言,在服务器上解析。您无法在浏览器上修改PHP的变量。
尝试将单选按钮选项作为表单提交到PHP页面中。