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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.