Jump to content

Noob Needs help


MadDawgX

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]
Link to comment
https://forums.phpfreaks.com/topic/11663-noob-needs-help/
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)
Link to comment
https://forums.phpfreaks.com/topic/11663-noob-needs-help/#findComment-44046
Share on other sites

Archived

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

×
×
  • Create New...

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.