This is very basic, I know – but I simply can’t figure out why this short section of PHP code isn’t working for me? I’m trying to get a IF statement happening in my function, and then execute the function somewhere on my document so it returns “../”.
<?php $confirm = "yes"; ?>
<?php
function clientarea() {
if (isset($confirm)) {
if ($confirm == "yes") {
echo "../";
}
}
}
?>
<img src="<?php clientarea(); ?>images/logo.png" alt="Logo" />
Any ideas why this code doesn’t work for me?
This should work better:
You can better use booleans instead of “yes” or “no”…
I modified your code: