stefan1294 Posted October 17, 2012 Share Posted October 17, 2012 (edited) My question is in the title. How will I be able to get something like that? I did some research, I was checking a couple of tutorials, etc.. But no result, so I'd like to ask it here. Edit: Of course my idea is just to update a 'div' when they go to the about page, for example. Edited October 17, 2012 by stefan1294 Link to comment Share on other sites More sharing options...
kanchatchai Posted October 17, 2012 Share Posted October 17, 2012 http://www.w3schools.com/php/php_get.asp 1 Link to comment Share on other sites More sharing options...
stefan1294 Posted October 17, 2012 Author Share Posted October 17, 2012 Thank you very much! Link to comment Share on other sites More sharing options...
JohnTipperton Posted October 19, 2012 Share Posted October 19, 2012 (edited) hi in getting the url link you need to use this <?php function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];} else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL;} echo curPageURL();?> try it works for me or use GET method http://www.w3schools.com/php/php_get.asp Edited October 19, 2012 by JohnTipperton Link to comment Share on other sites More sharing options...
westman Posted October 24, 2012 Share Posted October 24, 2012 (edited) <?phpif ($_GET['page'] != "") {if ($_GET['page'] == "home") {$page_div = $homepage;} else if ($_GET['page'] == "login") {$page_div = $login_page;}else if ($_GET['page'] == "signup") {$page_div = $signup_page;} else if (($_GET['page'] == "account") && ($login_count == 1)) {$page_div = $account_page;}else{$page_div = $homepage;}}else{ $page_div = $homepage;}?> <?php echo $page_div ?> Edited October 24, 2012 by westman Link to comment Share on other sites More sharing options...
thescientist Posted October 24, 2012 Share Posted October 24, 2012 (edited) <?php$page = 'home'; //some default value if(!empty($_GET['page']){ $page = $_GET['page'];} //or, possible one line solution$page = !empty($_GET['page']) ? $_GET['page'] : 'home' ?> Edited October 24, 2012 by thescientist Link to comment Share on other sites More sharing options...
kanchatchai Posted October 25, 2012 Share Posted October 25, 2012 <?phpif ($_GET['page'] != "") {if ($_GET['page'] == "home") {$page_div = $homepage;} else if ($_GET['page'] == "login") {$page_div = $login_page;}else if ($_GET['page'] == "signup") {$page_div = $signup_page;} else if (($_GET['page'] == "account") && ($login_count == 1)) {$page_div = $account_page;}else{$page_div = $homepage;}}else{ $page_div = $homepage;}?> <?php echo $page_div ?> i can't see where those variable com from.$homepage,$login_page,$signup_pag,$account_page may need define. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now