if(isset($_POST[‘submit’])){
$test_rep = $_POST[‘test_rep’];
$pat_id = $_POST[‘pat_id’];
global $wpdb;
if(isset($_FILES[‘support_images’][‘name’]))
{
$file_name_all=””;
for($i=0; $i<count($_FILES[‘support_images’][‘name’]); $i++)
{
$tmpFilePath = $_FILES[‘support_images’][‘tmp_name’][$i];
if ($tmpFilePath != “”)
{
$name = $_FILES[‘support_images’][‘name’][$i];
$size = $_FILES[‘support_images’][‘size’][$i];
list($txt, $ext) = explode(“.”, $name);
$file= time().substr(str_replace(” “, “_”, $txt), 0);
$info = pathinfo($file);
$filename = $file.”.”.$ext;
$path_array = wp_upload_dir();
$path = str_replace(‘\\’, ‘/’, $path_array[‘path’]);
if(move_uploaded_file($_FILES[“support_images”][“tmp_name”][$i],$path. “/” . $filename))
{
date_default_timezone_set (“Asia/Calcutta”);
$currentdate=date(“d M Y”);
$file_name_all.=$filename.”*”;
}
}
}
$list_images = rtrim($file_name_all, ‘*’);
}
$hosp_images = $append_data.’*’.$list_images;
$succ = $wpdb->insert(‘patient_reports’,array(‘Patiant_id’=>$pat_id,’tests’=>$test_rep,’reports’=>$list_images),array(‘%d’,’%s’,’%s’));
if($succ==1){
echo ‘<span style=”color: #28BA46; font-weight: bold; font-size: 17px; margin-top: 16px;”>Report submitted success fully</span>’;
}
}