基本上我想要实现的是一个简单的PHP开/关,我有PHP代码设置为0但能够从表单中将其更改为1或0。
PHP file| $settingon = 1 //1 for active, 0 for inactive
HTML file| <form action="php/settingfile.php">
<input type="radio" name="settingon" value="1"> Active<br>
<input type="radio" name="settingon" value="0"> Inactive<br>
<button type="submit">Save Settings</button>
</form>
答案 0 :(得分:0)
如果要禁用输入:
<form action="php/settingfile.php">
<input type="radio" name="settingon" <?php $settingon? "":"disabled" ?>> Active<br>
<button type="submit">Save Settings</button>
</form>
或创建一个显示输入的类:
<form action="php/settingfile.php">
<input type="radio" name="settingon" class="<?php $settingon? "active":"inactive" ?>"> Active<br>
<button type="submit">Save Settings</button>
</form>