Jump to content

[SOLVED] Simple PHP Question


F1racer328

Recommended Posts

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 :D

Link to comment
https://forums.phpfreaks.com/topic/146343-solved-simple-php-question/
Share on other sites

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);
?>

Archived

This topic is now archived and is closed to further replies.

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