Is my syntax wrong?

I’m a newbie and can’t get this If else statement to work. It’s supposed to point to a file named “main_menu.js” from one of 2 folders (/js or/js2) depending on the current page - what’s wrong??

$bios = '<script type="text/javascript" src="/js2/main_menu.js"></script>';
$other = '<script type="text/javascript" src="/js/main_menu.js"></script>';
if($folder == 'bios') {
echo "$bios";
} else {
echo "$other";


I changed:
if($folder == ‘bios’) {


if($folder = ‘bios’) {

Though it still doesn’t work, using the == caused the script to ignore the output completely. Now I get output but it outputs:

<script type="text/javascript" src="/js2/accordion.js"></script>

regardless of $folder’s value.

Where do you expect the value of $folder to come from? You have not defined it. Maybe you meant $_GET[‘folder’]

Thanks cmalibu - it was procedural: I had the definition of $folder below the conditional statement. problem solved.

I’m glad you got it figured out. But for future reference, the reason
$folder = ‘bios’ “worked” is because a single equals sign is “assignment” so the conditional translates to
“If the $folder variable is assigned the value of ‘bios’”
Not what you want here.

Right - I knew that it should be a comparison operator but was trying syntax alternatives to solve it (out of desperation) when there were clues that the problem was procedural. Invariably, these early “lessons” become the foundation of understanding.

Thanks for all the feedback.