I want to know how to edit my database.txt file by switching the button. I'm just starting to learn and I hope to understand how to implement it.
Database.txt
1|on|on|on|;
setting.php
<?php <label class="switch"> <input type="checkbox" name="switcha"> <div class="slider"></div> </label> if (isset($_POST['switcha'])) { } <label class="switch"> <input type="checkbox" name="switchb"> <div class="slider"></div> </label> if (isset($_POST['switchb'])) { } <label class="switch"> <input type="checkbox" name="switchc"> <div class="slider"></div> </label> if (isset($_POST['switchc'])) { } ?>
This is a redirect to enable or disable the page
redirection.php
<?php $data = file_get_contents("database.txt"); $rows = explode("|", $data); $redirectiona = $rows[1]; $redirectionb = $rows[2]; $redirectionc = $rows[3]; if($redirectiona == "on"){ header('location: 1.php'); exit(); } if($redirectionb == "on"){ header('location: 2.php'); exit(); } if($redirectionc == "on"){ header('location: 3.php'); exit(); } ?>
I've tried a few different things and can't figure out what the value is "off" if not enabled and "on" if enabled. Sorry this may seem simple but I'm just getting started.