Page 1 of 1

Get script with text showing all the time

Posted: Sat Jan 10, 2009 11:50 am
by Aki
I used to work with PHP a long time ago so my memory is kind of fuzzy, but I can't find the problem with this. The text in $output is supposed to show only when the URL is get.php?move=w, yet it shows on the normal get.php as well. What's the problem?

Code: Select all

<?php
 
    if($_GET['move'] = "w") {
$output .= "
                <p>Some textelitexttext.</p>
";
 
    }
    else {
    $output .= " ";
    }
 
echo $output;
 
?>

Re: Get script with text showing all the time

Posted: Sat Jan 10, 2009 12:45 pm
by sergio-pro
Hi

The If expression should be made with == operator.

Re: Get script with text showing all the time

Posted: Sat Jan 10, 2009 12:49 pm
by jaoudestudios
You need double equals

Code: Select all

if ($_GET['move'] == 'w') ...

Re: Get script with text showing all the time

Posted: Sat Jan 10, 2009 1:05 pm
by Aki
Now it works. Thanks. :)