MadDawgX Posted June 10, 2006 Share Posted June 10, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/11663-noob-needs-help/ Share on other sites More sharing options...
joquius Posted June 10, 2006 Share Posted June 10, 2006 ok I advise to go back over the basic operators.First, $_GET['var'] is right but = will not given you a true resultyou 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) Quote Link to comment https://forums.phpfreaks.com/topic/11663-noob-needs-help/#findComment-44046 Share on other sites More sharing options...
MadDawgX Posted June 10, 2006 Author Share Posted June 10, 2006 Okay thanx, I got it to work. Quote Link to comment https://forums.phpfreaks.com/topic/11663-noob-needs-help/#findComment-44047 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.