<?php

$cardno = $_POST['cardno'];
$c_status = $_POST['c_status'];
$V_idno = $_POST['V_idno'];
$c_name = $_POST['c_name'];
$m_name = $_POST['m_name'];
$f_name = $_POST['f_name'];
$Phone = $_POST['Phone'];
$email = $_POST['email'];
$profession = $_POST['profession'];
$age = $_POST['age'];
$sex = $_POST['sex'];
$m_status = $_POST['m_status'];
$address = $_POST['address'];
$District = $_POST['District'];

if(!$con)
{
    die ('could not connect'.mysql_error());
}
    mysql_select_db('fastcashcard',$con)

    mysql_query("INSERT INTO cardinfo('cardno','c_status','V_idno','c_name','m_name','f_name','Phone',`email`,'age','sex','m_status', 'address','District') 
VALUES('$cardno','$c_status','$V_idno','$c_name','$m_name','$f_name','$Phone','$email', '$profession', '$age', '$sex','$m_status','$address','$District')");

echo "Your record successfully Inserted";

mysql_close($con);

?>

Recommended Answers

All 3 Replies

see your backtick on your email field of line 24 ('cardno','c_status','V_idno','c_name','m_name','f_name','Phone',email,'age','sex','m_status', 'address','District')

Change the quotes on email to be single quotes. So, your code should be;

     mysql_query("INSERT INTO cardinfo('cardno','c_status','V_idno','c_name','m_name','f_name','Phone','email','age','sex','m_status', 'address','District') 
        VALUES('$cardno','$c_status','$V_idno','$c_name','$m_name','$f_name','$Phone','$email', '$profession', '$age', '$sex','$m_status','$address','$District')");

On line 22 you are missing a semicolon on the end of the statement.

In the query all the field names should be enclosed in backticks and not in single quotes (a mysql syntax requirement).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.