inserting values into mysql using php self-defined functions
<p>I would like to insert values into a MySQL database but the values are not inserting and I don't know whats wrong.</p>

<p>Here is my code:</p>

<pre><code>&lt;?php


include("inc/connection.php");

function RegisterStep1() {

        $txtuser = $_POST['txtName'];
        $txtsurname = $_POST['txtSurname'];
        $txtemail = $_POST['txtEmail'];
        $txtpass = $_POST['txtPassword'];
        $txtconfirmpass = $_POST['txtConfirmPass'];
        $txtcontactperson = $_POST['txtcompanycontactname'];
        $txtCompAddress = $_POST['txtCompAddress'];
        $txtRegNo = $_POST['txtRegNo'];
        $txtuserpos = $_POST['txtuserpos'];
        $txtdepartment = $_POST['txtdepartment'];
        $txtcontacts = $_POST['txtcontacts'];
        /* check if values are posted */



        $txtuser = mysql_real_escape_string($_POST['txtName']);
        /* combo company type */
        $txtCompAddress = mysql_real_escape_string($_POST['txtCompAddress']);
        /* combo locations
         */
        $txtRegNo = mysql_real_escape_string($_POST['txtRegNo']);
        /* combo companysize */
        $txtcontactperson = mysql_real_escape_string($_POST['txtcompanycontactname']);
        $txtsurname = mysql_real_escape_string($_POST['txtSurname']);
        $txtuserpos = mysql_real_escape_string($_POST['txtuserpos']);

        $txtdepartment = mysql_real_escape_string($_POST['txtdepartment']);
        $txtcontacts = mysql_real_escape_string($_POST['txtcontacts']);
        $txtemail = mysql_real_escape_string($_POST['txtEmail']);
        $txtpass = mysql_real_escape_string($_POST['txtPassword']);
        $txtconfirmpass = mysql_real_escape_string($_POST['txtConfirmPass']);



        $q = "INSERT INTO company(Name,Type,Address,Location,RegisteredNumber,CompanySize,ContactPerson,Surname,Position,Department,Contacts,DateResgistered,AccountStatus,Email,Password)
      Values('" . $txtuser . "','" . $txtCompAddress . "','" . $txtRegNo . "','" . $txtcontactperson . "','" . $txtsurname . "','" . $txtuserpos . "','" . $txtRegNo . "','" . $txtdepartment . "','" . $txtcontacts . "','" . $txtemail . "','" . $txtpass . "')";

        $submitquery = mysql_query($q);
        if ($submitquery) {
            echo"&lt;div id='results'&gt;Error occured while creating account,please try again in few minutes&lt;/div&gt;";
        } else {
            echo "&lt;div id='results'&gt;Thanks for signing up&lt;/div&gt;";
        }

}

?&gt;
</code></pre>
