Click here to Skip to main content
15,910,277 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am not able to find the error .. I beg you to do this for me. code is not able to submit data
PHP
include ('../config.php');

if (isset($_POST['submit']))
{
    $fullName =$_POST['fullName'];
    $email = $_POST['email'];
    $mobile = $_POST['mobile'];
    $dob = $_POST['dob'];
    $ddlType = $_POST['ddlType'];    
    $pincode = $_POST['pincode'];
    $address = $_POST['address'];
    $ddlState = $_POST['ddlState'];    
    $query = $_POST['query'];
//    
//    $from = new DateTime($dob);
//    $to   = new DateTime('today');
//    echo "age = ".$from->diff($to)->y; 
//
//    
    
    echo $insertQuery = "INSERT INTO `customerdetail`( fullName, email, dob, mobile, address, state, pincode, InsurenceType, query) VALUES ('$fullName','$email',$dob,$mobile,'$address','$ddlState',$pincode,'$ddlType', '$query')"; 
    
    $insertCmd = $CS->query($insertQuery);
    print_r($insertCmd);
    
    if(!$insertCmd){
        echo 'data is not submited';
    }
 else {
    echo 'data is  submited';
    }
    
    
}
Posted
Updated 20-Dec-15 3:59am
v8
Comments
CHill60 14-Dec-15 11:09am    
What error?
Harsh Kumar 20-Dec-15 9:58am    
data is not submiting
phil.o 14-Dec-15 11:13am    
Richard Deeming 14-Dec-15 11:20am    
Your code is vulnerable to SQL Injection[^].

NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.

1 solution

An SQL INSERT query doesn't look like that. It looks like
SQL
INSERT INTO MyTable (NameOfMyColumn1, NameOfMyColum2) VALUES (ValueForMyColumn1, ValueForMyColumn2)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900