SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict amy.damnit's Avatar
    Join Date
    Sep 2009
    Posts
    336
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Famous Undefined Variable

    During my registration process, one forms calls another and data is supposed to be passed to the next form.

    I am using the $_SESSION array and NetBeans shows a value in the variable $_SESSION['account_results'] while on the first page, however the second page is coming up with an error message complaining about "Undefined Variable _SESSION"???

    Here are relevant snippets of my code...

    104_CreateUserAccount
    Code:
              // Create "Account Created" message.
              $_SESSION['account_results'] =
                "Congratulations, " . $first_name . ", your account has been created!!" .
                "<p>To complete this process, you must now \"activate\" your account.<br />" .
                "An email has been sent to: " . $email1 . "</p>" .
                "<p>Please click on the link inside that e-mail to \"activate\" your account.</p>";
    
              // Continue Registration.
              header('Location: 105_ActivateAccount.php');
    
          } else {
              // Insert failed.
              echo '<p class="error">You could not be registered due to
                      a system error. We apologize for any inconvenience.</p>';
          }
    
          // Close Database Connection.
          mysqli_close($dbc);
        }
    
      // Flush Values & Close Output Buffering.
      ob_end_flush();
      }
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
    <head>

    105_ActivateAccount
    Code:
    <?php
    
    
    
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
    <head>
      <title>Account Created</title>
      <meta http-equiv="content-type" content="text/html; charset=utf-8" />
      <!-- <link href="includes/105_AccountCreated.css" rel="stylesheet" type="text/css" /> -->
      <style type="text/css">
      </style>
    </head>
    <body>
      <div id="wrapper">
        <div id="header">
          Account Created
        </div>
    
        <div id="content">
          <h2>You are almost done...</h2>
    
          <div id="message">
    
            <h3><?php echo $_SESSION['account_results']; ?></h3>
    
          </div>
    Error Message from NetBeans:
    Notice: Undefined variable: _SESSION in /Users/user1/Documents/DEV/+htdocs/SeminarRegistration/105_ActivateAccount.php on line 150
    Call Stack
    # Time Memory Function Location
    1 0.0040 64288 {main}( ) ../105_ActivateAccount.php:0

    What am I doing wrong?



    Amy
    Last edited by amy.damnit; Oct 10, 2009 at 16:02. Reason: Added Error Message

  2. #2
    SitePoint Zealot Kayarc's Avatar
    Join Date
    Sep 2009
    Posts
    127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    do you have session_start();?
    Phoenix Arizona Web Design | info *at* kayarc.com | 602.633.2676

  3. #3
    SitePoint Addict amy.damnit's Avatar
    Join Date
    Sep 2009
    Posts
    336
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kayarc View Post
    do you have session_start();?
    I just found the answer right before you posted.

    This link does a nice job explaining things!

    What a NEWBIE mistake?!

    You were correct, though. That fixed things.

    Thanks anyways!


    Amy

  4. #4
    SitePoint Zealot Gman's Avatar
    Join Date
    Jan 2002
    Location
    Sarasota, FL
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by amy.damnit View Post
    I just found the answer right before you posted.

    This link does a nice job explaining things!

    What a NEWBIE mistake?!

    You were correct, though. That fixed things.

    Thanks anyways!


    Amy
    Don't beat yourself so hard.. we all had to start somewhere, no one is going to know everything, it's a constant learning experience

    Have fun!!

  5. #5
    SitePoint Addict amy.damnit's Avatar
    Join Date
    Sep 2009
    Posts
    336
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Gman View Post
    Don't beat yourself so hard.. we all had to start somewhere, no one is going to know everything, it's a constant learning experience

    Have fun!!
    Yah, I know, but still!

    Thanks!


    Amy


Bookmarks

Posting Permissions

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