Undefined Variable...

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Undefined Variable...

    Hi,

    wieder ein kleines Problem. Nachdem bei mir eine Session registered wird erscheint ein kleines Submenu. Dort sind mittels switch Links eingebettet. Sobald man jedoch einen Link klickt (funzt einwandfrei) bekomme ich die nachricht:

    My Profile

    Notice: Undefined variable: member_profile in /home/www/htdocs/hovercraftracing.net/test.php on line 264
    My Driver Profile
    » View Driver Profiles
    » Create Driver Profile

    E-Mail

    Notice: Undefined variable: member_email in /home/www/htdocs/hovercraftracing.net/test.php on line 289
    Private Messages

    Notice: Undefined variable: member_pm in /home/www/htdocs/hovercraftracing.net/test.php on line 302

    Wobei die Links trotzdem weiterhin funzen?!
    Hier der Code auszug:
    PHP-Code:
                  <?php
                                
    if (! session_is_registered("authemail")) {
                                }
                                else {
                                
    ?>
                                <tr>
                                    
                    <td><img src="images/boxhead_newsletter.gif" alt="Press" width="170" height="20"></td>
                                </tr>
                                <tr>
                                    
                    <td bgcolor="#AFBC7F" align="center" valign="top"> <table width="160" border="0" cellspacing="0" cellpadding="0">
                        <tr> 
                          <td><span class="boxhead"><a class="nav" href="?member_profile=profile">My 
                            Profile </a></span></td>
                        </tr>
                        <tr> 
                          <td class="boxtext"> 
                            <?PHP switch($member_profile)
                            {
                            case 
    "profile": include("member/profile.php"); break;
                            }
                            
    ?>
                          </td>
                        </tr>
                        <tr> 
                          <td class="nav"><a class="nav" href="?member_dprofile=driver_profile">My 
                            Driver Profile</a></td>
                        </tr>
                        <tr> 
                          <td class="boxtext"> 
                            <?PHP switch($member_dprofile)
                            {
                            case 
    "driver_profile": include("member/driverprofile.php"); break;
                            }
                            
    ?>
                          </td>
                        </tr>
                        <tr> 
                          <td><span class="boxhead"><a class="nav" href="?member_email=email">E-Mail</a></span></td>
                        </tr>
                        <tr> 
                          <td class="boxtext"> 
                            <?PHP switch($member_email)
                            {
                            case 
    "email": include("member/email.php"); break;
                            }
                            
    ?>
                          </td>
                        </tr>
                        <tr> 
                          <td><span class="boxhead"><a class="nav" href="?member_pm=pm">Private 
                            Messages </a></span></td>
                        </tr>
                        <tr> 
                          <td class="boxtext"> 
                            <?PHP switch($member_pm)
                            {
                            case 
    "pm": include("member/pm.php"); break;
                            }
                            
    ?>
                          </td>
                        </tr>
                      </table></td>
                    </tr>
                    <tr>
                     <td bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="7"></td>
                    </tr>
                    <?
                    }
                    ?>
    The Human Mirror - Mein Blog!
    www.sonicsense.de - The future of music!

  • #2
    Re: Undefined Variable...

    wenn du beispielweise diesen link
    <a class="nav" href="?member_profile=profile">
    anklickst - woher sollen denn dann im script die übrigen variablen kommen ($member_dprofile, $member_email, $member_pm, etc.)?
    I don't believe in rebirth. Actually, I never did in my whole lives.

    Kommentar


    • #3
      Sie stehen doch immer noch da?! Wenn ich diesen Link klicken würde würde ja nur eine Datei includet werden. Was nichts daran ändert das die Switchbefehle dort stehen wo sie vorher auch standen.

      Oder versteh ich da was falsch?
      The Human Mirror - Mein Blog!
      www.sonicsense.de - The future of music!

      Kommentar


      • #4
        die variablen sind nicht definiert, vorher mit if(isset()) oder if(empty()) prüfen.

        oder mit $deine_variable = ''; definieren
        mfg
        marc75

        <Platz für anderes>

        Kommentar


        • #5
          Das Menü funktioniert aber einwandfrei wenn

          PHP-Code:
          wenn <?php

                                      
          if (! session_is_registered("authemail")) {

                                      }

                                      else {

                                      
          ?>
          nicht davor steht.
          The Human Mirror - Mein Blog!
          www.sonicsense.de - The future of music!

          Kommentar


          • #6
            Original geschrieben von Hazzardous
            Sie stehen doch immer noch da?!
            die switchabfragen stehen da, ja.
            aber wo bitte ist der teil, wo du diese variablen definierst/deklarierst?

            Oder versteh ich da was falsch?
            ich denke ja.
            I don't believe in rebirth. Actually, I never did in my whole lives.

            Kommentar


            • #7
              Wieso muss ich das?

              Es funktionier doch hier auch einwandfrei:
              Der einzige unterschied ist eben die Tatsache das die Tabelle immer da ist und nicht nur da ist wenn die session registred ist. Darum versteh ich es wohl auch nicht...

              PHP-Code:
              <table width="160" border="0" cellspacing="0" cellpadding="0">
                                                       <tr> 
                                    <td><span class="boxhead"><a class="nav" href="?action_com=com">Community</a></span></td>
                                  </tr>
                                  <tr> 
                                    <td class="boxtext"> 
                                      <?PHP switch($action_com)
                                      {
                                      case 
              "com": include("menu_left/menu_com.php"); break;
                                      }
                                      
              ?>
                                    </td>
                                  </tr>
                                   <tr> 
                                    <td class="nav"><a class="nav" href="?action_pic=pics">Pictures/Series</a></td>
                                  </tr>
                                  <tr> 
                                    <td class="boxtext"> 
                                      <?PHP switch($action_pic)
                                      {
                                      case 
              "pics": include("menu_left/menu_pic.php"); break;
                                      }
                                      
              ?>
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td><span class="boxhead"><a class="nav" href="?action_vids=vids">TV-Clips/Trailers</a></span></td>
                                  </tr>
                                  <tr> 
                                    <td class="boxtext"> 
                                      <?PHP switch($action_vids)
                                      {
                                      case 
              "vids": include("menu_left/menu_vid.php"); break;
                                      }
                                      
              ?>
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td><span class="boxhead"><a class="nav" href="?action_board=board">Board</a></span></td>
                                  </tr>
                                  <tr> 
                                    <td class="boxtext"> 
                                      <?PHP switch($action_board)
                                      {
                                      case 
              "board": include("menu_left/menu_board.php"); break;
                                      }
                                      
              ?>
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td><span class="boxhead"><a class="nav" href="?action_shop=shop">Shop</a></span></td>
                                  </tr>
                                  <tr> 
                                    <td class="boxtext"> 
                                      <?PHP switch($action_shop)
                                      {
                                      case 
              "shop": include("menu_left/menu_shop.php"); break;
                                      }
                                      
              ?>
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td><span class="boxhead"><a class="nav" href="?action_racing=racing">Racing</a></span></td>
                                  </tr>
                                  <tr> 
                                    <td class="boxtext"> 
                                      <?PHP switch($action_racing)
                                      {
                                      case 
              "racing": include("menu_left/menu_racing.php"); break;
                                      }
                                      
              ?>
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td><span class="boxhead"><a class="nav" href="?action_ehc=ehc">European 
                                      Championship</a></span></td>
                                  </tr>
                                  <tr> 
                                    <td class="boxtext"> 
                                      <?PHP switch($action_ehc)
                                      {
                                      case 
              "ehc": include("menu_left/menu_ehc.php"); break;
                                      }
                                      
              ?>
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td><span class="boxhead"><a class="nav" href="?action_whc=whc">World 
                                      Championship</a></span></td>
                                  </tr>
                                  <tr> 
                                    <td class="boxtext"> 
                                      <?PHP switch($action_whc)
                                      {
                                      case 
              "whc": include("menu_left/menu_whc.php"); break;
                                      }
                                      
              ?>
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td><span class="boxhead"><a class="nav" href="?action_infos=infos">Infos</a></span></td>
                                  </tr>
                                  <tr> 
                                    <td class="boxtext"> 
                                      <?PHP switch($action_infos)
                                      {
                                      case 
              "infos": include("menu_left/menu_infos.php"); break;
                                      }
                                      
              ?>
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td><span class="boxhead"><a class="nav" href="?action_intouch=intouch">InTouch</a></span></td>
                                  </tr>
                                  <tr> 
                                    <td class="boxtext"> 
                                      <?PHP switch($action_intouch)
                                      {
                                      case 
              "intouch": include("menu_left/menu_intouch.php"); break;
                                      }
                                      
              ?>
                                    </td>
                                  </tr>
                                </table>
              The Human Mirror - Mein Blog!
              www.sonicsense.de - The future of music!

              Kommentar


              • #8
                http://www.google.de/search?sourceid...ed+variable%3A
                Ergebnisse 1 - 10 von ungefähr 159,000 für Notice: Undefined variable:. (0.25 Sekunden)

                http://www.php-resource.de/forum/sea...der=descending
                Zeige Themen 1 bis 25 von 73 Treffern

                http://www.dclp-faq.de/q/q-fehler-variable.html
                mfg
                marc75

                <Platz für anderes>

                Kommentar


                • #9
                  Danke für die links.
                  Das erklärt mir trotzdem nicht warum ich einmal die Variablen deklarieren muss und einmal nicht!
                  The Human Mirror - Mein Blog!
                  www.sonicsense.de - The future of music!

                  Kommentar


                  • #10
                    Original geschrieben von Hazzardous
                    Danke für die links.
                    Das erklärt mir trotzdem nicht warum ich einmal die Variablen deklarieren muss und einmal nicht!
                    weil die einmal gesetzt ist und einmal nicht, was ist denn daran unklar.
                    mfg
                    marc75

                    <Platz für anderes>

                    Kommentar

                    Lädt...
                    X