Jump to content

Archived

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

xyn

breaking.

Recommended Posts

Hi,
I have my script which is attached below, I have it in the correct place on my Index.php page and I have the "exit;" code but this obviously exits the loading so I can't load the rest of the page to show my copyright and Links at the bottom.

I'm basically wondering if anyone has any directional help they could offer me to swapping the exit; with break; and then at the bottom of the code i can return; the script. although when i last tried it I got parse errors.

[code=php:0]<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="184">
  <tr>
    <td width="100%" height="57" colspan="2">
    <p align="center">Top</td>
  </tr>
  <tr>
    <td width="21%" height="93">Nav</td>
    <td width="79%" height="93"><?PHP
    $p = $_GET['page'];
   
    if( !$p ){
    include "welcome.php";
    break;
   
    } elseif( $p == action ){
    include "page.php";
    break;
   
    }else{
    die('No such page');
    }
    return;
    ?></td>
  </tr>
  <tr>
    <td width="100%" height="32" colspan="2">
    <p align="center">copyright</td>
  </tr>
</table>[/code]

Share this post


Link to post
Share on other sites
Try a switch statment instead:
[code=php:0]switch(@$_GET['page'])
{
    case 'action':
        include "page.php";
    break;

    default:
        if(!isset($_GET['page']))
        {
            echo 'No such page';
        }
        else
        {
            include "welcome.php";
        }
    break;
}[/code]

Share this post


Link to post
Share on other sites
alright how do i add other pages into the switch?

Share this post


Link to post
Share on other sites
Add more cases!

[code]switch(@$_GET['page'])
{
    case 'action':
        include "page.php";
    break;

    case 'mysecondaction':
        include "mysecondpage.php";
    break;

    default:
        if(!isset($_GET['page']))
        {
            echo 'No such page';
        }
        else
        {
            include "welcome.php";
        }
    break;
}[/code]

Share this post


Link to post
Share on other sites

×

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.