I'm new in programming field. I uploaded a form of html page, i have created two input field:- upload profile and signature which i 'm trying to insert these two field in different folders eg: profile in Uploads/profile/ and signature in Uploads/sign/. But its save only one field image not both.
And also i have no idea how to save these two images with name of id(unique name) and Doctor name (input text field). For eg: in database doctor name: Amit, id: 31; so im trying to save image name is Amit31. please help me out.
here is my php code:
<?php
require 'config.php';
if(isset($_POST['submit'])){
$file1 = $_FILES['doc_profile']['name'];
$file_tmp1 = $_FILES['doc_profile']['tmp_name'];
$pro = "Upload/Profile/" . $file1;
$file2 = $_FILES['sign']['name'];
$file_tmp2 = $_FILES['sign']['tmp_name'];
$signature = "Upload/sign/" . $file2;
$data= [];
$data= [$file1,$file2];
$images= implode(' ',$data);
$Name = $_POST['Name'];
$gender = $_POST['gender'];
$phone = $_POST['phone'];
$location = $_POST['location'];
$Qualification = $_POST['Qualification'];
$Speciality = $_POST['Speciality'];
$Experience = $_POST['Experience'];
$License_No = $_POST['License_No'];
$Email = $_POST['Email'];
$Password = $_POST['Password'];
//$Image = $_POST['Image'];
//$Signature = $_POST['Signature'];
header("Location: sign.html");
$sql = ("INSERT INTO doctor (Doctor_Name, gender, Phone, Location, Qualification, Speciality, Experience, License_No, Email, Password) value('$Name', '$gender', '$phone', '$location', '$Qualification', '$Speciality', '$Experience', '$License_No', '$Email', '$Password')");
$insertquery= mysqli_query($con, $sql);
if($insertquery){
move_uploaded_file($file_tmp1, $pro);
move_uploaded_file($file_tmp2, $signature);
echo "success";
}
else{
echo "ERROR: $sql <br> $con->error";
}
$con->close();
}
?>