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 635485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:24:35+00:00 2026-05-13T20:24:35+00:00

Here is the code. I really dont why it is not submitting my information.

  • 0

Here is the code.

I really dont why it is not submitting my information.

<?php

//Includes mass includes containing all the files needed to execute the full script
//Also shows homepage elements without customs

include ("includes/mass.php");


//Grabbing data form POST array and storing in variables plus the date

$username   = ($_POST['username']);
$password   = ($_POST['password']);
$conpassword= ($_POST['password2']);
$firstname  = ($_POST['firstname']);
$lastname   = ($_POST['lastname']);
$email      = ($_POST['email']);
$submit     = ($_POST['submit']);
$date       = date("Y-m-d");


//Reigstration Form         

$register = "<div id='registration'> 
                <h2>Register Here!</h2>
                <form action='register.php' method='post'> 
                <table>
                <tr>
                    <td>
                Username
                    </td>
                    <td>
                <input type='text' name='username' value='$username' >
                    </td>
                </tr>
                <tr>
                    <td>
                Password
                    </td>
                    <td>
                <input type='password' name ='password'>
                    </td>
                </tr>
                <tr>
                    <td>
                Confirm Password
                    </td>
                    <td>
                <input type='password' name ='password2'>
                    </td>
                </tr>
                <tr>
                    <td>
                Firstname
                    </td>
                    <td>
                <input type='text' name='firstname' value='$firstname'>
                    </td>
                </tr>
                <tr>
                    <td>
                Lastname
                    </td>
                    <td>
                <input type='text' name='lastname' value='$lastname' >
                    </td>
                </tr>
                <tr>
                    <td>
                Email
                    </td>
                    <td>
                <input type='text'  name='email' value= '$email' >
                    </td>
                </tr>
                <tr>
                    <td>
                <input type='submit'  class='button' name='submit' value='Sign Up'>
                    </td>
                </tr>
                </table>    
                </form>
            </div>";

echo $register;         


//Check to make sure user has submitted the correct details
echo "<div id='regform'>";
    if (isset($submit))

        {
            //Querying the database for if the username already exists

            $sql = "SELECT * FROM user WHERE username = '$username'";

                       $query = mysql_query($sql);

                     $numrows = mysql_num_rows($query);

                     while ($row = mysql_fetch_assoc($query))

                                    {
                                     $dbusername = $row['username'];
                                     $dbpassword = $row['password'];
                                    } 

                if (strlen($username)<2)

                    {

                     echo ("<br>You must enter a longer username</br>");

                     exit;

                    }

                elseif (strlen($username) > 25)

                    {
                     echo ("You must enter a shorter username<br>");

                     exit;

                    }

                if ($username==$dbusername)

                    {

                     echo ("That username already exists!");

                     exit;

                    }

                elseif (strlen($password)<6) 

                    {

                     echo ("<br>'Password must be be between 6 & 26 characters'<br>");

                     exit;

                    }

                 if ($password != $conpassword)

                    {

                     echo ("<br>Your passwords dont match<br>");

                     exit;

                    }

                elseif (strlen($firstname)<=0) 

                    {

                     echo ("<br>You must enter your firstname<br>");

                     exit;

                    }

                if (strlen($lastname)<=0) 

                    {

                     echo ("<br>You must enter your lastname<br>");

                     exit;

                    }

                elseif (!preg_match('/@/',$email) || (strlen($email)<=6) ) 

                    {

                     echo ("</br>You must enter a proper email address!");

                     exit;

                    }

                if (!isset($password))

                    {
                     echo "You must enter a password!";

                     exit;

                    }

                elseif (!isset($conpassword))

                    {

                     echo ("You must confirm your password");

                     exit;

                    }

                else

                    {

                        //Encrypt the password

                        $password = md5($password);
                        $conpassword = md5($conpassword);

                        //Start Session

                        session_start();

                        //push this information to the database

                        //Submit data to database plus store exec into variable.

                        $sqlsubmit ="INSERT INTO user VALUES ('','$firstname','$lastname','$username','$password','$email','$date',)";

                        mysql_query($sqlsubmit);

                        //echo success.



                     echo "successfully submitted to the database"."<br>"."<a href='user.php'>Click Here To Go To Your Accont</a>";

                     exit;


                    }   

         }  

    elseif(!isset($submit))

        {
         echo "</br>"."Enter your info here!!!!! :))";
        }

echo "</div>";  

?>
  • 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-13T20:24:35+00:00Added an answer on May 13, 2026 at 8:24 pm

    Update: As Quassnoi so subtly points out, you urgently need to secure your input. See the chapter SQL Injection in the PHP manual.

    The query fails because you have an extra comma at the end of the line:

      $sqlsubmit ="INSERT INTO user VALUES 
     ('','$firstname','$lastname','$username','$password','$email','$date',)";
    

    Use echo mysql_error(); to find out such errors.

    Also, the success message gets output, regardless whether the query fails or not.
    You want to add a condition:

    if (mysql_query($sqlsubmit))
     echo "successfully submitted ...";
    else
     echo "error submitting ..... ".mysql_error();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 357k
  • Answers 357k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The other answers are correct. Here is some code you… May 14, 2026 at 9:40 am
  • Editorial Team
    Editorial Team added an answer you ruin the noConflict concept by reassigning the jquery to… May 14, 2026 at 9:40 am
  • Editorial Team
    Editorial Team added an answer If you get that particular error, you don't actually have… May 14, 2026 at 9:40 am

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.