0

Can never seem to get things to work!

<?php
if(isset($_POST['add']))
{
$person_id = $_POST['person_id'];

if (isset($_POST["cv"])) {
    $cv=1;
} else {
    $cv=0;
}   
if (isset($_POST["document_id"])) {
    $document_id=1;
} else {
    $document_id=0;
}
if (isset($_POST["application_form"])) {
    $application_form=1;
} else {
    $application_form=0;
}
if (isset($_POST["passport"])) {
    $passport=1;
} else {
    $passport=0;
}
if (isset($_POST["criminal_disclosure"])) {
    $criminal_disclosure=1;
} else {
    $criminal_disclosure=0;
}
if (isset($_POST["medical_clearance"])) {
    $medical_clearance=1;
} else {
    $medical_clearance=0;
}
if (isset($_POST["reference"])) {
    $reference=1;
} else {
    $reference=0;
}
if (isset($_POST["educational"])) {
    $educational=1;
} else {
    $educational=0;
}
if (isset($_POST["passport_photo"])) {
    $passport_photo=1;
} else {
    $passport_photo=0;
}
if (isset($_POST["innoculation"])) {
    $innoculation=1;
} else {
    $innoculation=0;
}

$sql = "INSERT INTO `teaching`.`documents` (`document_id`, `person_id`,'cv','application_form','passport','criminal_disclosure','medical_clearance','reference','educational','passport_photo','innoculation') 
VALUES ('NULL', '$person_id', '$cv','$application_form','$passport','$criminal_disclosure','$medical_clearance','$reference','$educational','$passport_photo','$innoculation')";

Bunch of check boxes that need to be saved. Below is the error.

Could not enter data: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''cv','application_form','passport','criminal_disclosure','medical_clearance','re' at line 1

Where have I gone wrong this time? Thought if I cycled through each checkbox it would work?

1
Contributor
1
Reply
10
Views
3 Years
Discussion Span
Last Post by CarterLangley
0

Never mind, managed to figure this one out. Damn back ticks catching me out again!!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.