form submission code for thankyou.php page to insert form data into user table?

I am unable to get the user form data to insert into my mysql database. I have the action=“thankyou.php” and have placed the following php code top that page…


require_once( ‘nipadmin/config.php’ );
require_once( ‘nipadmin/utils.php’ );

define( ‘DB_HOST’, ‘host’ );
define( ‘DB_USER’, ‘user’ );
define( ‘DB_PASS’, ‘pass’ );
define( ‘DB_NAME’, ‘db’ );

if ($dbConn = mysql_connect(DB_HOST, DB_USER, DB_PASS))
    if (mysql_select_db(DB_NAME, $dbConn))
        $firstName = mysql_real_escape_string($_POST['firstname']);
        $lastName = mysql_real_escape_string($_POST['lastname']);
        $phone = mysql_real_escape_string($_POST['phone']);
        $state = mysql_real_escape_string($_POST['state']);
        $event = mysql_real_escape_string($_POST['event']);
        $siteCode = mysql_real_escape_string($_POST['scode']);
        $ipAddress = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);

        $dbQuery = mysql_query("INSERT INTO user_signup
                        (event_id, firstname, lastname, email, phone, state, sitecode, ip_address, date)
                        VALUES (".$event.", '".$fistName."', '".$lastName."', '".$email."', '".$phone."', '".$state."', '".$siteCode.", '".$ipAddress."', ".time().")", $dbConn);
        if (!$dbQuery) { print ' MySQL Error: '.mysql_error().' '; }
    else { print ' MySQL Error: '.mysql_error().' '; }
else { print ' MySQL Error: '.mysql_error().' '; }


Can somebody let me know what is keeping my script from submitting the form data input by the user…I’ve been stumped for sometime now…need help. thanks in advance! If this is of any help here is the site with the form…


What error message are you getting? You may need to check your database field types.

Sponsor our Newsletter | Privacy Policy | Terms of Service