Your First Php Page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Your First Php Page


    <?php

    $action = $_GET["action"];
    /// Action
    if($action=="first")
    {
    /// First Page
    echo "page1";
    exit();
    }
    if($action=="second")
    {
    /// Second Page
    echo "page2";
    exit();
    }
    else
    {
    /// Default page at browser cces
    echo "page1";
    exit();
    ?>

    #2
    You wont to know better options ?

    Code:
    <?php
    ////PLACE YOU HEADERS HERE
    ////
    ///////////////////////////////
    $action = $_GET["action"];
    /// Action 
    //Main page here
    if($action=="")
    {
    ///  Page 
    echo "page";
    /////////////////FOOTERS HERE
    exit();
    }
    
    //// just copy the second page and name what ever
    if($action=="second")
    {
    /// Second Page 
    echo "page2";
    /////////////////FOOTERS HERE
    exit(); 
    }
    else
    {
    /// ERROR PAGE
    echo "ERROR PAGE";
    /////////////////FOOTERS HERE
    exit();
    ?>
    Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
    Visit: WapMasterz Coming Back Soon!
    _______
    SCRIPTS FOR SALE BY SUBZERO
    Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
    FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
    _______
    Info & Tips
    php.net
    w3schools.com

    Comment


      #3
      or

      Code:
      <?php
      
      $Action = $_GET["Action"];
      
      switch ($Action) {
      case "First":
          echo "First page";
          break;
      case "Second":
          echo "Second page";
          break;
      default:
          echo "Default page";
      }
      ?>
      url: domain/index.php?Action=First

      can be this way too

      Code:
      <?php
      
      $Action = $_SERVER["QUERY_STRING"];
      
      switch ($Action) {
      case "First":
          echo "First page";
          break;
      case "Second":
          echo "Second page";
          break;
      default:
          echo "Default page";
      }
      ?>
      url: domain/index.php?First

      Comment


        #4
        sub, one question, can i declare an variable like this

        Code:
        $Action = $Action ? $_GET["Action"] : $_SERVER["QUERY_STRING"];
        to use both variables as one?

        that url can be: ?First and ?Action=First ? i never used that lol

        edit:

        yay it works :D

        Code:
        <?php
        
        /**
         * @author Milomir
         * @copyright 2008
         */
        
        $Action = $Action ? $_GET["Action"] : $_SERVER["QUERY_STRING"];
        
        switch ($Action) {
        case "First":
            echo "First page";
            break;
        case "Second":
            echo "Second page";
            break;
        default:
            echo "Default page";
        }
        
        ?>
        thats the best option :D

        Comment


          #5
          yes you can but where the footer and headers go ??
          lol

          :D
          Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
          Visit: WapMasterz Coming Back Soon!
          _______
          SCRIPTS FOR SALE BY SUBZERO
          Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
          FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
          _______
          Info & Tips
          php.net
          w3schools.com

          Comment


            #6
            <?php

            if(!isset($_GET[&#39;type&#39;])) $_GET[&#39;type&#39;] = &#39;&#39;;
            switch($_GET[&#39;type&#39;]) {

            case &#39;&#39;: // first page
            //script
            break;

            case &#39;two&#39;: //second page
            //script
            break;
            }

            ?>

            name.php // first page
            name.php?type=two //second page
            http://ngeo.ro

            Comment


              #7
              yes you can but where the footer and headers go ??
              lol

              :D[/b]
              well :D header and footer goes here:

              Code:
              <?php
              
              /**
              * @author Milomir
              * @copyright 2008
              */
              
              class Template
              {
              
                function tHeader()
                {
                    header("Content-Type: text/html");
                  echo "<?xml version=\"1.0\"?>\n";
              ?>
              <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
              <html xmlns="http://www.w3.org/1999/xhtml">
              <head>
              <title>MySite</title>
              <meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=ISO-8859-1" />
              </head>
              <body>
              <?php
                }
              
                function tFooter()
                {
              ?>
              </body>
              </html>
              <?php
                }
              
              }
              
              $Action = $Action ? $_GET["Action"] : $_SERVER["QUERY_STRING"];
              
              $Template = new Template;
              
              $Template->tHeader();
              
              switch ($Action) {
              case "First":
                  echo "First page";
                  break;
              case "Second":
                  echo "Second page";
                  break;
              default:
                  echo "Default page";
              }
              
              $Template->tFooter();
              
              ?>
              something like that :D

              Comment

              Working...
              X