Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Warning message in my PHP code.

    Hi,

    I just changed the a website to a new web host and now I am getting warning messages in the following pages:

    Notice: Undefined index: cat in /clientdata/clients/w/e/welcome.asn.au/www/practice.php on line 6

    Notice: Undefined index: pic in /clientdata/clients/w/e/welcome.asn.au/www/practice.php on line 11


    http://www.welcome.asn.au/new.php
    http://www.welcome.asn.au/practice.php

    I must of turned off warnings in the old web host. Could anyone tell me how to fix the code?

    PHP Code:
    <?php

      $cat 
    "";
      
    $pic "";
      
      if (
    $_GET["cat"] != "") {
          
    $cat $_GET["cat"];
      } else {
          
    $cat "";
      }
      if (
    $_GET["pic"] != "") {
        
    $pic $_GET["pic"];
      } 

     if (
    $cat == "roam") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "roam";
        }
        include(
    "practice/series/roam/r_thumb.php");
      }    else if (
    $cat == "bound") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "b_mca";
        }
        include(
    "practice/series/bound/b_thumb.php");    
        }    else if (
    $cat == "estate") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "de_pers";
        include(
    "practice/series/estate/d_thumb.php");    
        }
        
        }    else if (
    $cat == "portrait") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "p_kirby";
        }
        include(
    "practice/portrait/p_desc.php");    
        }    else if (
    $cat == "portrait") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "p_wrees";
        }
        include(
    "practice/portrait/p_desc.php");    
        
        }    else if (
    $cat == "untitled") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "1_s";
        }
        include(
    "practice/untitled/un_pic.php");
            
            }    else if (
    $cat == "progress") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "l_jsm";
        }
        include(
    "practice/progress/luna/luna_d.php");    

        
      } else {
        include(
    "p_header.php");
            
      }
    ?>
          </div>
          <div class="mainContentPanel">
    <?php 
            
    if ($cat == "roam") { print "<a href=\"practice/series/roam/roam_en/$pic.jpg\" target=\"new\" border=\"0\"><img src=\"practice/series/roam/$pic.jpg\"></a>";}
            else if (
    $cat == "bound") { print "<a href=\"practice/series/bound/bound_en/$pic.jpg\" target=\"new\" border=\"0\"><img src=\"practice/series/bound/$pic.jpg\"></a>"; }
            else if (
    $cat == "estate") { print "<a href=\"practice/series/estate/de_en/$pic.jpg\" target=\"new\" border=\"0\"><img src=\"practice/series/estate/$pic.jpg\"></a>"; }
            else if (
    $cat == "portrait") { print "<a href=\"practice/portrait/port_en/$pic.jpg\" target=\"new\" border=\"0\"><img src=\"practice/portrait/$pic.jpg\"></a>"; }
            else if (
    $cat == "untitled"){ print "<br><br><br><br><a href=\"practice/untitled/un_en/$pic.jpg\" target=\"new\" border=\"0\"><img src=\"practice/untitled/$pic.jpg\"></a>"; }
            else if (
    $cat == "progress") { print "<a href=\"practice/progress/luna/luna_en/$pic.jpg\" target=\"new\" border=\"0\"><img src=\"practice/progress/luna/$pic.jpg\"></a>"; }



    ?>
        
    <?php include("p_foot.php"); ?>

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Try this
    PHP Code:
    <?php

      $cat 
    "";
      
    $pic "";
      
      if (isset(
    $_GET["cat"]) && $_GET["cat"] != "") {
          
    $cat $_GET["cat"];
      } else {
          
    $cat "";
      }
      if (isset(
    $_GET["pic"]) && $_GET["pic"] != "") {
        
    $pic $_GET["pic"];
      } 

     if (
    $cat == "roam") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "roam";
        }
        include(
    "practice/series/roam/r_thumb.php");
      }    else if (
    $cat == "bound") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "b_mca";
        }
        include(
    "practice/series/bound/b_thumb.php");    
        }    else if (
    $cat == "estate") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "de_pers";
        include(
    "practice/series/estate/d_thumb.php");    
        }
        
        }    else if (
    $cat == "portrait") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "p_kirby";
        }
        include(
    "practice/portrait/p_desc.php");    
        }    else if (
    $cat == "portrait") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "p_wrees";
        }
        include(
    "practice/portrait/p_desc.php");    
        
        }    else if (
    $cat == "untitled") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "1_s";
        }
        include(
    "practice/untitled/un_pic.php");
            
            }    else if (
    $cat == "progress") {
        include(
    "p_header.php");
        if (
    $pic == "") {
            
    $pic "l_jsm";
        }
        include(
    "practice/progress/luna/luna_d.php");    

        
      } else {
        include(
    "p_header.php");
            
      }
    ?>
          </div>
          <div class="mainContentPanel">
    <?php 
            
    if ($cat == "roam") { print "<a href=\"practice/series/roam/roam_en/$pic.jpg\" target=\"new\" border=\"0\"><img src=\"practice/series/roam/$pic.jpg\"></a>";}
            else if (
    $cat == "bound") { print "<a href=\"practice/series/bound/bound_en/$pic.jpg\" target=\"new\" border=\"0\"><img src=\"practice/series/bound/$pic.jpg\"></a>"; }
            else if (
    $cat == "estate") { print "<a href=\"practice/series/estate/de_en/$pic.jpg\" target=\"new\" border=\"0\"><img src=\"practice/series/estate/$pic.jpg\"></a>"; }
            else if (
    $cat == "portrait") { print "<a href=\"practice/portrait/port_en/$pic.jpg\" target=\"new\" border=\"0\"><img src=\"practice/portrait/$pic.jpg\"></a>"; }
            else if (
    $cat == "untitled"){ print "<br><br><br><br><a href=\"practice/untitled/un_en/$pic.jpg\" target=\"new\" border=\"0\"><img src=\"practice/untitled/$pic.jpg\"></a>"; }
            else if (
    $cat == "progress") { print "<a href=\"practice/progress/luna/luna_en/$pic.jpg\" target=\"new\" border=\"0\"><img src=\"practice/progress/luna/$pic.jpg\"></a>"; }



    ?>
        
    <?php include("p_foot.php"); ?>
    I believe you need to check to see if the $_GET variable is set.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    Nov 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •