I am facing a problem with send variable data to mysql, one of my variable is passing but other is not.
<?php
session_start();
if(!isset($_SESSION["PAT_ID"])){
ob_start();
header("location: login.php");
ob_end_flush();
}
$patient_id ="";
$complainID = "";
$patient_id = $_SESSION["PAT_ID"];
if(isset($_GET["ComplainID"])){
$complainID = $_GET["ComplainID"];
}
include "config/connect_to_mysql.php";
?>
<?php
//Diesease photo\
echo "Hello Patient Your Complain ID: " . $complainID;
$imageerr = "";
$typeerr = "";
$sizeerr = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if( (isset($_FILES['galleryField_1']) && $_FILES['galleryField_1']['error'] == 0)
|| (isset($_FILES['galleryField_2']))
|| (isset($_FILES['galleryField_3']))
|| (isset($_FILES['galleryField_4']))
){
$allowedExts = array("JPEG", "jpeg", "jpg", "JPG");
$temp = explode(".", $_FILES["galleryField_1"]["name"]);
$extension = end($temp);
if ((
($_FILES["galleryField_1"]["type"] == "image/JPEG")
|| ($_FILES["galleryField_1"]["type"] == "image/jpeg")
|| ($_FILES["galleryField_1"]["type"] == "image/jpg")
|| ($_FILES["galleryField_1"]["type"] == "image/JPG"))
&& in_array($extension, $allowedExts)){
if($_FILES['galleryField_1']['size'] > 1048576) { //1 MB (size is also in bytes)
$sizeerr = "Photo must be within 1 MB";
} else{
// Add this image into the database now
$sql = mysql_query("INSERT INTO `shasthojito`.`sdispic` (`sdis_pic_id`, `pat_id`, `comp_id`) VALUES (NULL, '$patient_id', '$complainID')")
or die (mysql_error());
$gallery_id = mysql_insert_id();
// Place image in the folder
$newgallery = "$gallery_id.jpg";
move_uploaded_file( $_FILES['galleryField_1']['tmp_name'], "dpic/$newgallery");
}
}else{
$typeerr = "You have to put JPEG Image file";
}
}else{
$imageerr = "No Image Selected";
}
Here the variable $patientID is working fine and passing the data into it, but the $complainID is not working on sql query but its showing the value in echo ...