Jump to content

Recommended Posts

Posted

Yeah, I seem to be overlooking something really simple again today, but I can't figure it out. (Yeah I sent this as a PM but I thought I should put it here instead.)

 

Source:

<?php
    $filename = $_GET['file'];
    $location = $_GET['where'];
    if ($filename) {
        if ($location = "main") {
            print($filename . ' - ' . $location);
        } else if ($location = "home") {
            print($filename . ' - ' . $location);
        } else if ($location = "scoizzle") {
            print($filename . ' - ' . $location);
        }
    }
?>

 

No matter what I put for "where", I get $location printed as "main". So if I go to

, they both print "test.txt - main".

 

Thanks,

~Derek

Posted

Should be == instead of =.

 

if ($location == "main")

 

<?php
        $filename = $_GET['file'];
        $location = $_GET['where'];
        if ($filename) {
                if ($location == "main") {
                        print($filename . ' - ' . $location);
                } else if ($location == "home") {
                        print($filename . ' - ' . $location);
                } else if ($location == "scoizzle") {
                        print($filename . ' - ' . $location);
                }
        }
?>

 

Posted
Should be == instead of =.

 

omg I swear I tried that already (because Java uses "==" too), but I must have forgotten to FTP or something >.>

 

Thanks--again.

 

P.S.: Yeah, I'm updating my Profile and signature, etc. I figure it's about 2 years overdue. :S

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...