title: Notice: Undefined index: ZZZZZZWTF?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index">PHP: &ldquo;Notice: Undefined variable&rdquo;  and &ldquo;Notice: Undefined index&rdquo;</a>  </p>
  </blockquote>
  
  
  
  <p>All of a sudden my php code has come up with :</p>
  
  <p>Notice: Undefined index: submit in C:\xampp\htdocs\globalautoparts\register.php on line 36</p>
  
  <p>Notice: Undefined index: fullname in C:\xampp\htdocs\globalautoparts\register.php on line 40</p>
  
  <p>Notice: Undefined index: username in C:\xampp\htdocs\globalautoparts\register.php on line 41</p>
  
  <p>Notice: Undefined index: password in C:\xampp\htdocs\globalautoparts\register.php on line 42</p>
  
  <p>Notice: Undefined index: repeatpassword in C:\xampp\htdocs\globalautoparts\register.php on line 43</p>
  
  <p>Notice: Undefined index: email in C:\xampp\htdocs\globalautoparts\register.php on line 45</p>
  
  <p>on the registration page. </p>
  
  <p>How do i fix it?</p>
  
  <p>This is my code:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt;
  &lt;head&gt;
      &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;
      &lt;meta name="author" content="Luka Cvrk (solucija.com)" /&gt;
      &lt;meta name="keywords" content="conceptnova, concept, framework, web, content, corporate, business" /&gt;
      &lt;meta name="description" content="Conceptnova" /&gt;   
      &lt;link rel="stylesheet" href="css/main.css" type="text/css" media="screen, projection" /&gt;
      &lt;title&gt;Global Autoparts | Home&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="wrap"&gt;
          &lt;div id="header_top"&gt;
          &lt;h1 id="logo"&gt;&lt;a href="#" title="Conceptnova"&gt;&lt;img src="images/logo.gif" align="left" /&gt;&lt;/a&gt;&lt;/h1&gt;
          &lt;h1 id="logo"&gt;&lt;/h1&gt;
          &lt;ul&gt;
                  &lt;li&gt;&lt;a href="index.php"&gt;home&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="aboutus.php"&gt;about us&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="services.php"&gt;services&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="portfolio.php"&gt;portfolio&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="contact.php"&gt;contact&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
              &lt;div id="slogan"&gt;
                  &lt;p&gt;&lt;/p&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div id="header_bottom"&gt;
              &lt;h2&gt;Think outside of the box!&lt;/h2&gt;
              &lt;p&gt;Registering with Global Auto Parts means you have access to super-fast online orders and total user customization, so you wont have to wait in a line again!&lt;/p&gt;
          &lt;/div&gt;  
          &lt;div id="maincontent"&gt;
              &lt;div id="left"&gt;
                  &lt;h2&gt;&lt;a href="#"&gt;Register to become apart of the global community!&lt;/a&gt;&lt;/h2&gt;
                  &lt;p&gt;&lt;?php
  echo "&lt;h1&gt;Registration Page.&lt;/h1&gt;";
  $submit = $_POST['submit'];
  
  
  //form data
  $fullname = strip_tags($_POST['fullname']);
  $username = strtolower(strip_tags($_POST['username']));
  $password = strip_tags($_POST['password']);
  $repeatpassword = strip_tags($_POST['repeatpassword']);
  $date = date("Y-m-d");
  $email = $_POST['email'];
  
  if ($submit)
  {
  
       //open database
       $connect = mysql_connect("localhost","root","");
                  mysql_select_db("phplogin"); //select database
  
       $namecheck = mysql_query("SELECT username FROM users WHERE username='$username'");
       $count = mysql_num_rows($namecheck);
  
       if  ($count!=0)
  
       {
         die("Username already taken! Go &lt;a href='register.php'&gt;back&lt;/a&gt; to try again?");
  
       }
  
       // check for existence
       if($fullname&amp;&amp;$username&amp;&amp;$password&amp;&amp;$repeatpassword)
       {
  
  
         if ($password==$repeatpassword)
         {
  
                 //check char length of username and fullname
                 if (strlen($username)&gt;25||strlen($fullname)&gt;25)
                 {
                 echo "Length of username or fullname is too long!";
  
  
                 }
  
                 else{
                 //check password length
                 if (strlen($password)&gt;25||strlen($password)&lt;6)
                 {
                 echo "Password must be between 6 and 25 characters";
                 }
                 else{
                 //register the user!
  
                 // encrypt password
         $password = md5($password);
         $repeatpassword = md5($repeatpassword);
  
  
                    //generate random number for activation process
                    $random = rand(23456789,98765432);
                  $queryreg = mysql_query("
  
                  INSERT INTO users VALUES ('','$fullname','$username','$password','$email','$date','$random','0')
  
                  ");
  
                  $lastid = mysql_insert_id();
  
  
                  //send activation email
                  ini_set("SMTP",$server);
                  $to = $email;
                  $subject = "Activate your account!";
                  $headers = "From: Global Auto Parts";
                  $server = "localhost";
  
  
  
  
  
                  $body = "
  
                  Hello $fullname,\n\n
  
                  You need to activate your account with the link below:
  
                  http://localhost/globalautoparts/activate.php?=$lastid&amp;code=$random \n\n
  
  
                  Thanks.
  
                  ";
  
                  //function to send mail
                  mail($to, $subject, $body, $headers);
  
                  die("You have been registered! Check your email to activate your account!");
                 }
  
  
                 }
         }
         else
         echo "Your passwords do not match!";
  
       }
      else
          echo "Please fill in &lt;b&gt;all&lt;/a&gt; fields!";
  
  
  
  
  }
  
  ?&gt;
  
  &lt;html&gt;
  &lt;p&gt;
  &lt;form action='register.php' method='POST'&gt;
        &lt;table&gt;
               &lt;tr&gt;
                   &lt;td&gt;
                   Your full name:
                   &lt;/td&gt;
                   &lt;td&gt;
                   &lt;input type='text' name='fullname' value='&lt;?php echo $fullname; ?&gt;'&gt;
                   &lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td&gt;
                   Choose a username:
                   &lt;/td&gt;
                   &lt;td&gt;
                   &lt;input type='text' name='username' value='&lt;?php echo $username; ?&gt;'&gt;
                   &lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td&gt;
                   Choose a password:
                   &lt;/td&gt;
                   &lt;td&gt;
                   &lt;input type='password' name='password'&gt;
                   &lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td&gt;
                   Repeat your password:
                   &lt;/td&gt;
                   &lt;td&gt;
                   &lt;input type='password' name='repeatpassword'&gt;
                   &lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td&gt;
                   Email:
                   &lt;/td&gt;
                   &lt;td&gt;
                   &lt;input type='text' name='email'&gt;
                   &lt;/td&gt;
               &lt;/tr&gt;
        &lt;/table&gt;
        &lt;br /&gt;
        &lt;p&gt;
        &lt;input type='submit' name='submit' value='Register'&gt;
  &lt;/form&gt;
  &lt;/p&gt;
              &lt;/div&gt;  
              &lt;div id="right"&gt;
                  &lt;div id="searchform"&gt;
                      &lt;form method="post" action="#"&gt;
                          &lt;p&gt;&lt;input type="text" name="search" class="search" value="Search Keywords" /&gt;&lt;input type="submit" value="GO" class="submit" /&gt;&lt;/p&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
                  &lt;p&gt;
  
                  &lt;html&gt;
  
  &lt;form action='login.php' method='POST'&gt;
  
      Username: &lt;input type='text' name='username'&gt;&lt;br /&gt;&lt;br /&gt;
      Password: &amp;nbsp;&lt;input type='password' name='password'&gt;&lt;br /&gt;&lt;br /&gt;
      Click &lt;a href='register.php'&gt;here&lt;/a&gt; to register. &lt;input type='Submit' value='Login' id="login"&gt;
  
  &lt;/form&gt;    &lt;p&gt;
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
                  &lt;/p&gt;
                  &lt;br /&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div id="footer"&gt;
              &lt;p&gt;&amp;copy; Copyright 2011 &lt;a href="#"&gt;Global Autoparts&lt;/a&gt;&amp;nbsp;&amp;nbsp;Design: Victor Gatto  &lt;/p&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  &lt;!--REGBOX--&gt;
  </code></pre>