Get script with text showing all the time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Aki
Forum Newbie
Posts: 8
Joined: Fri Jan 09, 2009 5:38 pm

Get script with text showing all the time

Post 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;
 
?>
User avatar
sergio-pro
Forum Commoner
Posts: 88
Joined: Sat Dec 27, 2008 12:26 pm

Re: Get script with text showing all the time

Post by sergio-pro »

Hi

The If expression should be made with == operator.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Get script with text showing all the time

Post by jaoudestudios »

You need double equals

Code: Select all

if ($_GET['move'] == 'w') ...
Aki
Forum Newbie
Posts: 8
Joined: Fri Jan 09, 2009 5:38 pm

Re: Get script with text showing all the time

Post by Aki »

Now it works. Thanks. :)
Post Reply