I'm new to PHP so excuse me in advance! I have done the following code to show two different buttons depending on if $status in the file vars.php is set 1 or 0 using . So far so good.
The problem: I now trying to make a very simple page with two option fields to set the $status in the vars.php. I want the script to read what the value of $status is and pres-select the corresponding option box, and have a submit button that saved either 1 or 0 to $status.
It sounds so simple, but I can't get this it to work.. I don't want to use a database, the file can be txt, xml or whatever. Please anyone help me!
Below is the IF script that just checks for the status value 1 or else.
<?php include 'vars.php'; ?>
<?php if ($status == "1") { ?>
<a class="button" href="pageA.php">Read more</a>
<?php } else { ?>
<a class="button" href="pageB.php">Read more</a>
<?php } ?>
What I'm trying to create is a tiny form with two options where I can swap the $status value between 1 and 0 (with the form option being pre-selected with whatever value $status has). When I press update it should overwrite the $status value in the vars.php.