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 Link to comment https://forums.phpfreaks.com/topic/146343-solved-simple-php-question/ 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); ?> Link to comment https://forums.phpfreaks.com/topic/146343-solved-simple-php-question/#findComment-768307 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. Link to comment https://forums.phpfreaks.com/topic/146343-solved-simple-php-question/#findComment-768308 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? Link to comment https://forums.phpfreaks.com/topic/146343-solved-simple-php-question/#findComment-768309 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. Link to comment https://forums.phpfreaks.com/topic/146343-solved-simple-php-question/#findComment-768518 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.