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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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