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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:05:36+00:00 2026-06-13T10:05:36+00:00

i have a members registration form that displays perfectly until i add the php.

  • 0

i have a members registration form that displays perfectly until i add the php. Once the php code is added the form completely disappears. I have tried everything but i think a fresh set of eyes is needed at this stage.
Any help would be greatly appreciated. Cheers.

<?php

if ( $_POST['registerbtn'] ) {
    $getuser = $_POST['user'];
    $getemail = $_POST['email'];
    $getpass = $_POST['pass'];
    $getretypepass = $_POST['retypepass'];

    if ($getuser) {
        if ($getemail) {
            if($getpass) {
                if ($getretypepass) {
                    if ($getpass === $getretypepass) {
                        if ( (strlen($getemail) >= 7) && (strstr($getemail, "@")) && (strstr($getemail, "."))) {
                            require("./connect.php");

                            $query = mysql_query("SELECT * FROM users WHERE username='$getuser'");
                            $numrows = mysql_num_rows($query);
                            if ($numrows == 0){
                                    $query = mysql_query("SELECT * FROM users WHERE email='$getemail'");
                                    $numrows = mysql_num_rows($query);
                                    if ($numrows == 0){

                                        $password = md5($password);
                                        $date = date("F d, Y");
                                        $code = md5(rand());

                                        mysql_query("INSERT INTO users VALUES (
                                            '', '$getuser', '$getpassword', '$getemail', '0', '$getcode', '$getdate'
                                        )");



                                        $query = mysql_query("SELECT * FROM users WHERE username='$getusername'");
                                        $numrows = mysql_num_rows($query);
                                        if ($numrows == 1) {

                                            $site ="http://localhost/member.php";
                                            $webmaster = "Bror Phren <bmdoublec@hotmail.com>";
                                            $headers = "From: $webmaster";
                                            $subject = "Activate your account";
                                            $message = "Thanks for registering. Click the link below to activate your account";
                                            $message .= "$site/activate.php?user=$getuser&code=$code\n";
                                            $message .= "You must activate your account t login.";

                                            if (mail($getemail, $subject, $message, $headers) ) {
                                                $errormsg = "You have been registered. You must activate your account from the activation link sent to <b>$getemail</b> ";
                                                $getuser = "";
                                                $getemail = "";
                                            }
                                            else
                                                $errormsg = "An error has occured. Your activation email was not sent";


                                        }
                                        else
                                            $errormsg = "An error has occured. Your account was not created.\n";


                            }
                            else
                                $errormsg = "There is already a user with that email";

                            }
                            else
                                $errormsg = "There is already a user with that username";

                            mysql_close();


                        }
                        else
                        $errormsg = "You must enter a valid email address to register.";

                }
                else
                $errormsg = "You must retype your password to register.";

            }
            else
            $errormsg = "You must enter password to register.";

        }
        else
            $errormsg = "You must enter email to register.";

    }
    else
        $errormsg = "You must enter username to register.";

}

$form = "<form action='./register.php' method='post'>
<table>

    <tr>
    <td></td>
    <td><font color='red'>$errormsg</font></td>
    </tr>
    <tr>

    <td>Username:</td>
    <td><input type='text' name='user' value='$getuser' /></td>
    </tr>

    <tr>
    <td>Email:</td>
    <td><input type='text' name='email' value='$getemail' /></td>
    </tr>

    <tr>
    <td>Password:</td>
    <td><input type='password' name='pass' value='' /></td>
    </tr>

        <tr>
    <td>Retype:</td>
    <td><input type='password' name='retypepass' value='' /></td>
    </tr>

        <tr>
    <td>Retype:</td>
    <td><input type='submit' name='registerbtn' value='Register' /></td>
    </tr>

    </table>
</form>";

echo $form;

}

?>
  • 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-06-13T10:05:37+00:00Added an answer on June 13, 2026 at 10:05 am

    EDIT: As mentioned by Armon Toubman, the form will only display if relevant data has been posted to the page. You need to move the form outside of the if statement. See code below:

    <?php
    
    if ( $_POST['registerbtn'] ) {
        $getuser = $_POST['user'];
        $getemail = $_POST['email'];
        $getpass = $_POST['pass'];
        $getretypepass = $_POST['retypepass'];
    
        if ($getuser) {
            if ($getemail) {
                if($getpass) {
                    if ($getretypepass) {
                        if ($getpass === $getretypepass) {
                            if ( (strlen($getemail) >= 7) && (strstr($getemail, "@")) && (strstr($getemail, "."))) {
                                require("./connect.php");
    
                                $query = mysql_query("SELECT * FROM users WHERE username='$getuser'");
                                $numrows = mysql_num_rows($query);
                                if ($numrows == 0){
                                        $query = mysql_query("SELECT * FROM users WHERE email='$getemail'");
                                        $numrows = mysql_num_rows($query);
                                        if ($numrows == 0){
    
                                            $password = md5($password);
                                            $date = date("F d, Y");
                                            $code = md5(rand());
    
                                            mysql_query("INSERT INTO users VALUES (
                                                '', '$getuser', '$getpassword', '$getemail', '0', '$getcode', '$getdate'
                                            )");
    
    
    
                                            $query = mysql_query("SELECT * FROM users WHERE username='$getusername'");
                                            $numrows = mysql_num_rows($query);
                                            if ($numrows == 1) {
    
                                                $site ="http://localhost/member.php";
                                                $webmaster = "Bror Phren <bmdoublec@hotmail.com>";
                                                $headers = "From: $webmaster";
                                                $subject = "Activate your account";
                                                $message = "Thanks for registering. Click the link below to activate your account";
                                                $message .= "$site/activate.php?user=$getuser&code=$code\n";
                                                $message .= "You must activate your account t login.";
    
                                                if (mail($getemail, $subject, $message, $headers) ) {
                                                    $errormsg = "You have been registered. You must activate your account from the activation link sent to <b>$getemail</b> ";
                                                    $getuser = "";
                                                    $getemail = "";
                                                }
                                                else
                                                    $errormsg = "An error has occured. Your activation email was not sent";
                                            }
                                            else
                                                $errormsg = "An error has occured. Your account was not created.\n";
                                }
                                else
                                    $errormsg = "There is already a user with that email";
                                }
                                else
                                    $errormsg = "There is already a user with that username";
                            }
                            else
                            $errormsg = "You must enter a valid email address to register.";
                    }
                    else
                    $errormsg = "You must retype your password to register.";
                }
                else
                $errormsg = "You must enter password to register.";
            }
            else
                $errormsg = "You must enter email to register.";
    
        }
        else
            $errormsg = "You must enter username to register.";
        }
        mysql_close();
    }
    ?>
    <form action='./register.php' method='post'>
    <table>
    
        <tr>
          <td></td>
          <td><font color='red'><?php if(isset($errormsg){ echo $errormsg; } ?></font></td>
        </tr>
    
        <tr>    
          <td>Username:</td>
          <td><input type='text' name='user' value='<?php if(isset($getuser){ echo $getuser; } ?>' /></td>
        </tr>
    
        <tr>
          <td>Email:</td>
          <td><input type='text' name='email' value='<?php if(isset($getemail){ echo $getemail; } ?>' /></td>
        </tr>
    
        <tr>
          <td>Password:</td>
          <td><input type='password' name='pass' value='' /></td>
        </tr>
    
        <tr>
          <td>Retype:</td>
          <td><input type='password' name='retypepass' value='' /></td>
        </tr>
    
        <tr>
          <td>Retype:</td>
          <td><input type='submit' name='registerbtn' value='Register' /></td>
        </tr>
    
        </table>
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a basic form that I'm using for member registration. I'm using the
I have a registration form that user submits, data is sent using isset($_POST) to
I have created a registration/login system for my members area. Once the user has
I have members that can be blocked and when the member is blocked I
I have a need for two slightly different classes, that have the same members,
I have a web-site based on PHP, to which I would like to add
I have a Registration class that includes a QDate member. How do I initialize
I am trying to set-up a registration form that sends a welcoming email to
I am trying to design a user registration form using code igniter 2.1.0. I
I have a form set up and working nearly perfectly. I am using the

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.