I have a script that includes a config file (called accountsconfig.php) that contains a simple boolean:
<?php
$account = 'on';
?>
On my main script, I have a series of if else (if $account == true, do this, else this), but its always going to the else no matter what the value of $account is (As if it doesnt even get the value of $account). Heres an example of one of my ifelse:
<?php
include('accountsconfig.php');
if ($account == 'on') { ?>
<select name="account_number" >
<option value="one">Account One</option>
</select>
<?php } else { ?>
<h1> HIII</h1>
<?php } ?>
This file and the accountsconfig.php are located in the same directory.
*UPDATE:*
If i add <?php echo "$account" ?> between the in the else, it displays “off”
Any suggestions?
don’t use the word true
if you do the use === in stead of == as its boolean
use another word or number to represent what you are doing 1/yes 2/no