Jump to content

Archived

This topic is now archived and is closed to further replies.

MadDawgX

Noob Needs help

Recommended Posts

Hey there. Im fairly new to PHP and would like some help. Im trying to check for a variable in the address bar.

eg.

[code]http://www.twisterentertainment.org/news.php?page=1[/code]

What im trying to do is make an if statement that checks if page = 1 then do a series of html code. I've tried but it doesn't work, here it is.

[code]<?php
if ($_GET['page'] = 1) {
?>

// HTML CODE

<?php
}
?>[/code]

Share this post


Link to post
Share on other sites
ok I advise to go back over the basic operators.

First, $_GET['var'] is right but = will not given you a true result
you need to use
if ($_GET['var'] == 1)
however you can use $string = 1; to defined a string.

Also, I would advise to check if that HTTP_VAR exists first before putting it in a comparative function.

if (isset ($_GET['var']) && $_GET['var'] == 1)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.