Jump to content

breaking.


xyn

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]
Link to comment
https://forums.phpfreaks.com/topic/13830-breaking/
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]
Link to comment
https://forums.phpfreaks.com/topic/13830-breaking/#findComment-53777
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]
Link to comment
https://forums.phpfreaks.com/topic/13830-breaking/#findComment-53781
Share on other sites

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.