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

  • Home
  • SEARCH
  • 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 7846671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:39:38+00:00 2026-06-02T17:39:38+00:00

i have this page inserting data from html form. no error is showing but

  • 0

i have this page inserting data from html form. no error is showing but no data is inserted either. here is my code given.

<?php 
mysql_connect("localhost","root","");
mysql_select_db("hcp");

$queryUserType = "select * from user_type";
$resultUserType = mysql_query($queryUserType) or die(mysql_error());

$queryTitle = "select * from name_titles";
$resultTitle = mysql_query($queryTitle) or die(mysql_error());

$time = time();
$date = date("d-m-y");
$nowDateTime=$time.$date;

if($_REQUEST['btnUserSubmit'])
{
    $queryInsertUser="INSERT INTO  users (`title_id`, `first_name`, `last_name`, `email`, `utid`, `residence_address1`, `residence_address2`, `residence_city`, `residence_state`, `residence_country`, `residence_zipcode`, `phone_no`, `username`, `password`, `created`, `date_of_birth`, `gender` ) VALUES ('".mysql_real_escape_string($_REQUEST['$rowTitle[0]'])."', '".mysql_real_escape_string($_REQUEST['txtFirstName'])."', '".mysql_real_escape_string($_REQUEST['txtLastName'])."', '".mysql_real_escape_string($_REQUEST['txtEmail'])."', '".mysql_real_escape_string($_REQUEST['rowUserType[0]'])."', '".mysql_real_escape_string($_REQUEST['txtAddressLine1'])."', '".mysql_real_escape_string($_REQUEST['txtAddressLine2'])."', '".mysql_real_escape_string($_REQUEST['txtCity'])."', '" .mysql_real_escape_string($_REQUEST['txtState'])."', '".mysql_real_escape_string($_REQUEST['txtCountry'])."', '".mysql_real_escape_string($_REQUEST['txtPhone'])."', '".mysql_real_escape_string($_REQUEST['txtUserName'])."', '".mysql_real_escape_string($_REQUEST['txtUserPassword'])."', '".$nowDateTime."', '".mysql_real_escape_string($_REQUEST['txtdateofbirth'])."', '".mysql_real_escape_string($_REQUEST['rdGender'])."');";

$resultinsert=mysql_query($queryInsertUser) or die(mysql_error());
}
?>

i don;t have any problem where the page redirected. Form validation is still remaining. in this table, only email,utid,username,password this four fields are NOT NULL. remaining are Null allowed.

  • 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-02T17:39:40+00:00Added an answer on June 2, 2026 at 5:39 pm

    As you can see, your missing field 11, see below :

    <?php
    $QueryCol   = array('title_id',             // Field 1
                        'first_name',           // Field 2
                        'last_name',            // Field 3
                        'email',                // Field 4
                        'utid',                 // Field 5
                        'residence_address1',   // Field 6
                        'residence_address2',   // Field 7
                        'residence_city',       // Field 8
                        'residence_state',      // Field 9
                        'residence_country',    // Field 10
                        'residence_zipcode',    // Field 11
                        'phone_no',             // Field 12
                        'username',             // Field 13
                        'password',             // Field 14
                        'created',              // Field 15
                        'date_of_birth',        // Field 16
                        'gender');              // Field 17
    
    $QueryData  = array((isset($_REQUEST[$rowTitle[0]])      ? $_REQUEST[$rowTitle[0]]          : null),    // Field 1
                        (isset($_REQUEST['txtFirstName'])    ? $_REQUEST['txtFirstName']        : null),    // Field 2
                        (isset($_REQUEST['txtLastName'])     ? $_REQUEST['txtLastName']         : null),    // Field 3
                        (isset($_REQUEST['txtEmail'])        ? $_REQUEST['txtEmail']            : null),    // Field 4
                        (isset($_REQUEST[$rowUserType[0]])   ? $_REQUEST[$rowUserType[0]]       : null),    // Field 5
                        (isset($_REQUEST['txtAddressLine1']) ? $_REQUEST['txtAddressLine1']     : null),    // Field 6
                        (isset($_REQUEST['txtAddressLine2']) ? $_REQUEST['txtAddressLine2']     : null),    // Field 7
                        (isset($_REQUEST['txtCity'])         ? $_REQUEST['txtCity']             : null),    // Field 8
                        (isset($_REQUEST['txtState'])        ? $_REQUEST['txtState']            : null),    // Field 9
                        (isset($_REQUEST['txtCountry'])      ? $_REQUEST['txtCountry']          : null),    // Field 10
                                                                                                            // Field 11
                        (isset($_REQUEST['txtPhone'])        ? $_REQUEST['txtPhone']            : null),    // Field 12
                        (isset($_REQUEST['txtUserName'])     ? $_REQUEST['txtUserName']         : null),    // Field 13
                        (isset($_REQUEST['txtUserPassword']) ? $_REQUEST['txtUserPassword']     : null),    // Field 14
                        $nowDateTime,                                                                       // Field 15
                        (isset($_REQUEST['txtdateofbirth'])  ? $_REQUEST['txtdateofbirth']      : null),    // Field 16
                        (isset($_REQUEST['rdGender'])        ? $_REQUEST['rdGender']            : null);    // Field 17
    
    foreach($QueryData as $Key => $Value){
        $QueryData[$Key] = mysql_real_escape_string($Value);
    }
    
    $QueryInsertUser    =   'INSERT INTO users (`'.implode('`, `', $QueryCol).'`)'.
                            'VALUES ("'.implode('", "', $QueryData).'")';
    $resultinsert       =   mysql_query($QueryInsertUser)
                            or die(mysql_error());
    
    ?>
    

    Tips :

    1. Stop using $_REQUEST. Either use $_GET or $_POST
    2. Avoid using large line like you did. You cannot find an error quickly.
    3. Use array to write less code.
    4. Use array_walk function to map a function to every entry inside an array.
    5. Make your code sweet to read, easier to debug
    6. Variable like that $_REQUEST['$Blabla'] won’t work because using ‘ doesn’t work for parsing variable, use ” instead like that $_REQUEST["{$Blabla}"]. But, avoid that because PHP need to parse mean more power horse needed, use $_REQUEST[$Blabla] instead.
    7. While developing, I recommend the following lines at the top of your script :

      error_reporting(-1);
      ini_set('display_errors', 'On');
      

      It will display all errors. Even the one that aren’t really error. It will help you to write perfect code and standard code that’ll work everywhere.

    8. For every $_POST, $_GET, $_REQUEST, $_FILES, etc. use the function isset because it will generate an error.
    9. Remember, every error double the time to load the page. Try to create a page with let’s say 10000 rows with no errror, the average may be 0.01 second. With an error on each row, it may take 0.5 second. Watch that.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridView and I need update some data inserting HTML CODE; I
I am inserting the HTML response from an AJAX call into my page, but
So I have this page here: http://www.eminentmedia.com/development/powercity/ As you can see when you mouse
I have this html page which is very simple, it contains a text box
I have looked at this page for some time now. Amazing, really. But I
I'm loading and inserting html-code using Jquery Load() method. But when I'm trying to
I have a form which posts data to the same page. Based on the
I have an extensive form inserting into a SQL database and then from an
I have a web page that accepts an excel file, reads data from it
i have this page . login: fer password: m Note: after login you will

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.