我有一个与好看CSS样式下面的代码放在开关按钮提交PHP代码,当用户选中一个复选框
<?php
$wifi2g=file_get_contents("wifi2g.txt");
$wifi2g= trim ($wifi2g);
?>
<link rel="stylesheet" type="text/css" href="style.css">
<div class="onoffswitch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" <?php if ($wifi2g == "enabled") {echo "checked";} ?>>
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
我可以理解为你wifi2g.txt看到并定义按钮位置或关闭(选中或取消选中)。我有两个脚本,我想上传到ftp服务器wifion.php和wifioff.php。这些脚本取决于按钮的位置。当用户将按钮位置设置为ON(或选中)时,我想上传wifion.php,并设置为关闭或未选中时上传wifioff.php。我怎样才能做这项工作?我在这里找到这个按钮https://proto.io/freebies/onoff/
你必须使用的JavaScript。 – Barmar