Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6325663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:56:14+00:00 2026-05-24T16:56:14+00:00

Possible Duplicate: PHP: “Notice: Undefined variable” and “Notice: Undefined index” All of a sudden

  • 0

Possible Duplicate:
PHP: “Notice: Undefined variable” and “Notice: Undefined index”

All of a sudden my php code has come up with :

Notice: Undefined index: submit in C:\xampp\htdocs\globalautoparts\register.php on line 36

Notice: Undefined index: fullname in C:\xampp\htdocs\globalautoparts\register.php on line 40

Notice: Undefined index: username in C:\xampp\htdocs\globalautoparts\register.php on line 41

Notice: Undefined index: password in C:\xampp\htdocs\globalautoparts\register.php on line 42

Notice: Undefined index: repeatpassword in C:\xampp\htdocs\globalautoparts\register.php on line 43

Notice: Undefined index: email in C:\xampp\htdocs\globalautoparts\register.php on line 45

on the registration page.

How do i fix it?

This is my code:

<!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" xml:lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="author" content="Luka Cvrk (solucija.com)" />
    <meta name="keywords" content="conceptnova, concept, framework, web, content, corporate, business" />
    <meta name="description" content="Conceptnova" />   
    <link rel="stylesheet" href="css/main.css" type="text/css" media="screen, projection" />
    <title>Global Autoparts | Home</title>
</head>
<body>
    <div id="wrap">
        <div id="header_top">
        <h1 id="logo"><a href="#" title="Conceptnova"><img src="images/logo.gif" align="left" /></a></h1>
        <h1 id="logo"></h1>
        <ul>
                <li><a href="index.php">home</a></li>
                <li><a href="aboutus.php">about us</a></li>
                <li><a href="services.php">services</a></li>
                <li><a href="portfolio.php">portfolio</a></li>
                <li><a href="contact.php">contact</a></li>
          </ul>
            <div id="slogan">
                <p></p>
            </div>
        </div>
        <div id="header_bottom">
            <h2>Think outside of the box!</h2>
            <p>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!</p>
        </div>  
        <div id="maincontent">
            <div id="left">
                <h2><a href="#">Register to become apart of the global community!</a></h2>
                <p><?php
echo "<h1>Registration Page.</h1>";
$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 <a href='register.php'>back</a> to try again?");

     }

     // check for existence
     if($fullname&&$username&&$password&&$repeatpassword)
     {


       if ($password==$repeatpassword)
       {

               //check char length of username and fullname
               if (strlen($username)>25||strlen($fullname)>25)
               {
               echo "Length of username or fullname is too long!";


               }

               else{
               //check password length
               if (strlen($password)>25||strlen($password)<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&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 <b>all</a> fields!";




}

?>

<html>
<p>
<form action='register.php' method='POST'>
      <table>
             <tr>
                 <td>
                 Your full name:
                 </td>
                 <td>
                 <input type='text' name='fullname' value='<?php echo $fullname; ?>'>
                 </td>
             </tr>
             <tr>
                 <td>
                 Choose a username:
                 </td>
                 <td>
                 <input type='text' name='username' value='<?php echo $username; ?>'>
                 </td>
             </tr>
             <tr>
                 <td>
                 Choose a password:
                 </td>
                 <td>
                 <input type='password' name='password'>
                 </td>
             </tr>
             <tr>
                 <td>
                 Repeat your password:
                 </td>
                 <td>
                 <input type='password' name='repeatpassword'>
                 </td>
             </tr>
             <tr>
                 <td>
                 Email:
                 </td>
                 <td>
                 <input type='text' name='email'>
                 </td>
             </tr>
      </table>
      <br />
      <p>
      <input type='submit' name='submit' value='Register'>
</form>
</p>
            </div>  
            <div id="right">
                <div id="searchform">
                    <form method="post" action="#">
                        <p><input type="text" name="search" class="search" value="Search Keywords" /><input type="submit" value="GO" class="submit" /></p>
                    </form>
                </div>
                <p>

                <html>

<form action='login.php' method='POST'>

    Username: <input type='text' name='username'><br /><br />
    Password: &nbsp;<input type='password' name='password'><br /><br />
    Click <a href='register.php'>here</a> to register. <input type='Submit' value='Login' id="login">

</form>    <p>




















                </p>
                <br />

            </div>
        </div>
        <div id="footer">
            <p>&copy; Copyright 2011 <a href="#">Global Autoparts</a>&nbsp;&nbsp;Design: Victor Gatto  </p>
        </div>
    </div>
</body>

</html>
<!--REGBOX-->
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:56:15+00:00Added an answer on May 24, 2026 at 4:56 pm

    As the other guys suggested, you could

    Change the Error Reporting Level

    By running this code at the top of your script: error_reporting(E_ALL ^ E_NOTICE)

    Or, it might be a better idea to actually check whether those variables were posted before you use them.

    Quick and Dirty fix is to do this:

    @$_POST['submit']
    

    The @ sign will suppress any errors and return false in place of the string. Now that practice is generally frowned upon.

    If you want a cleaner method, I would do this:

    <?php 
    $post = array('fullname'=>'','username'=>'','password'=>'','repeatpassword'=>'');
    
    if($_POST) $post = array_merge($post, $_POST);
    
    $fullname = strip_tags($post['fullname']);
    $username = strtolower(strip_tags($post['username']));
    $password = strip_tags($post['password']);
    $repeatpassword = strip_tags($post['repeatpassword']);
    

    Then you’ll never have a error about missing indexes, and you can set the default values to whatever you like.

    Good luck

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: PHP: Notice: Undefined variable and Notice: Undefined index I am just learning
Possible Duplicate: PHP: Notice: Undefined variable and Notice: Undefined index I am new to
Possible Duplicate: Php: remove all tags, but “a href” in a text Is there
Possible Duplicate: When should I use “final”? PHP has a keyword 'final', Could you
Possible Duplicate: Can you “compile” PHP code? After I write an application in PHP,
Possible Duplicate: Objective C Equivalent of PHP's “Variable Variables” I'm studding Objective-C and have
Possible Duplicate: the code “ : ” in php I often see a lot
Possible Duplicate: Why does one often see “null != variable” instead of “variable !=
Possible Duplicate: How do I read a “,” as “<br />” in PHP/MySQL? This
Possible Duplicate: PHP String concatenation - “$a $b” vs $a . “ ” .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.