Jump to content

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

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.