F1racer328 Posted February 22, 2009 Share Posted February 22, 2009 Hey guys just wondering. Very simple php question. Im still little n00b at php but bear with me. <?php switch ($_GET['page']){ case'home': echo"home page codez here"; break; case 'register': echo"register"; break; } ?> So I have that code. The URL would be mysite.com/index.php?page=home And I would get that php echo page. How would I go with this to display say a already made page in html. Say I want to display http://mysite.com/news.php which is just plain html. And I want it to display on index.php? Any ideas? thanks Quote Link to comment Share on other sites More sharing options...
F1racer328 Posted February 22, 2009 Author Share Posted February 22, 2009 k. Found a way <?php switch ($_GET['go']) { case "1": $inc = 'Page01.php'; break; case "2": $inc = 'Page02.php'; break; case "3": $inc = 'Page03.php'; break; case "4": $inc = 'Page04.php'; break; default: $inc = 'Page01.php'; break; } include ($inc); ?> Quote Link to comment Share on other sites More sharing options...
Q695 Posted February 22, 2009 Share Posted February 22, 2009 put an HTML href of ' in the echo quotes, since it is easier to use " to output string values for variables in it. Quote Link to comment Share on other sites More sharing options...
Q695 Posted February 22, 2009 Share Posted February 22, 2009 Why wouldn't you just type include instead of setting $inc F1racer328? Quote Link to comment Share on other sites More sharing options...
F1racer328 Posted February 22, 2009 Author Share Posted February 22, 2009 Idk. Just less to type I guess. Quote Link to comment 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.