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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:26:51+00:00 2026-05-12T18:26:51+00:00

I am having a registration page. when the page is loaded, everytime it tries

  • 0

I am having a registration page. when the page is loaded, everytime it tries to insert the values in the textboxes which is empty by default at first. Please help. My code is attached

register.template.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RBlog - For the Consumers - By the Sellers</title>
<?php include("dbclass/register_class.php");?>
</head>
<body>
<?php include("includes/header.php"); ?>
    <div class="afterpicer_total">
    <?php include("includes/menu.php"); ?>
    <div class="wrapper">
            <div class="cont">
                <?php include("includes/left_menu.php"); ?>
                <div class="reg_cont">
                    <form name="add_user" method="post" action="<? echo $_SERVER['PHP_SELF']; ?>">

                        <div class="reg_label">Name</div>
                        <div class="reg_tbox"><input type="text" size="32" name="name" class="reg_tbox_style" ></input></div><br/>
                        <div class="reg_label">Email ID</div>
                        <div class="reg_tbox"><input type="text" size="32" name="email" class="reg_tbox_style"></input></div><br/>
                        <div class="reg_label" >Confirm Email ID</div>
                        <div class="reg_tbox"><input type="text" size="32" name="cemail" class="reg_tbox_style"></input></div><br/>
                        <div class="reg_label" >Password</div>
                        <div class="reg_tbox"><input type="text" size="32" name="pass" class="reg_tbox_style"></input></div><br/>
                        <div class="reg_label" >Confirm Password</div>
                        <div class="reg_tbox"><input type="text" size="32" name="cpass" class="reg_tbox_style"></input></div><br/>
                        <div class="reg_label" >Mobile No</div>
                        <div class="reg_tbox"><input type="text" size="32" name="mobile" class="reg_tbox_style"></input></div><br/>
                        <?

                            $adduser=new Users();
                $adduser->addDB();
                         ?>
                        <div class="reg_tbox"><input type="submit" value="Register" class="reg_but_style"style="margin-left:155px;"></input></div>


                    </form>

                </div>
           </div>
           <div class="adspace"> Advertisement Space</div>
        </div>
    </div>

</body>
</html>

register_class.php

<?php
ob_start();

    include("common/class.Database.php");
    include("common/varDeclare.php");

class Users extends Database
{
    var $fields_val = array();
    var $fields_value = array();
    var $state_name = array();
    var $db;
    function addDB()
    {   

        try{
            $reg_date           =date("Y-m-d G:i:s");

            $username           =$_POST[name];
            $email              =$_POST[email];
            $password           =$_POST[pass];
            $mobile             =$_POST[mobile];


                        $user_query = "insert into register set email = '".$email."', pwd = '".$password."', mobile = '".$mobile."', reg_date = '".$now."'";
            $insertUser=$this->do_query($user_query);


            $retVal=true;

                if(!$insertUser){
                  $this->errMsg = REG_FAILED;
                  $retVal = false;
                }       
            return $retVal;
        }
        catch(Exception $e)
        {
            echo 'Caught exception: ',  $e->getMessage(), "\n";
        }
    }

//  ---- End of addDB()------               

}
////////End of class/////////////
  • 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-12T18:26:51+00:00Added an answer on May 12, 2026 at 6:26 pm

    Blank values are inserted every time because in register.template.php, you haven’t inserted a conditional statement that executes addDB() only when the form has been submitted. You can solve this by changing

    $adduser=new Users();
    $adduser->addDB();
    

    to

    if ( $_SERVER['REQUEST_METHOD'] === 'POST' ) {
        $adduser=new Users();
        $adduser->addDB();
    }
    

    Also, you really should escape all of your $_POST values with mysql_real_escape_string if you plan on inserting them into a database that way.

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

Sidebar

Related Questions

i am new to asp.net mvc 2.0.Currently i am having registration page with fields
I am having difficulty using a thirdparty library registration function to register a callback.
Hi trying to make a Registration page with Ruby on rails using the tutorial
I'm having trouble with cookies on my site's registration form. When a user creates
I am building a PHP registration form which takes the following fields for up
But I'm having trouble with a new user registration form. Can someone explain this
I'm having some trouble implementing C2DM registration. My BroadcastReceiver is never called. I'm working
I am having a problem with Google Chrome. I have a jQuery Registration form:
I am having an WP7 application in which I need to change the Startup
I have a RegisterModel view model I use for my new account registration page.

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.