if(isset($_POST['Submit'])) { date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s ', time()); $name=trim(addslashes($_POST['name'])); $id_gender=trim(addslashes($_POST['id_gender'])); $phone=trim(addslashes($_POST['phone'])); $email=trim(addslashes($_POST['email'])); $password=trim(addslashes($_POST['p_word'])); $message=trim(addslashes($_POST['message'])); $time_id=trim(addslashes($_POST['time_id'])); $time_id_1=strtotime($time_id); $date_id=trim(addslashes($_POST['date_id'])); $date_id_1=strtotime($date_id); $appointment_time=date('h:i a', $time_id_1); $appointment_date=date('Y-m-d', $date_id_1); $appointment_time_1=date('h', $time_id_1); $appointment_time_2=date('i', $time_id_1); $appointment_time_3=date('a', $time_id_1); //$time_t=date('h:i a', $time_id); //$date_t=date('Y-m-d', $date_id); $Insert_Qry = "INSERT INTO tbl_member (`name`,`gender`,`phone`,`email`,`dob`,`password`) VALUES ('$name','$id_gender','$phone','$email','','$password')"; $Insert_Run = mysql_query($Insert_Qry) or die("Insert query error".mysql_error()); $attachmentfileid = mysql_insert_id(); $Insert_Qry_1 = "INSERT INTO tbl_appointment (`mem_id`,`appointment_date`,`hour_date`,`min_date`,`am_date`,`des`) VALUES ('$attachmentfileid','$appointment_date','$appointment_time_1','$appointment_time_2','$appointment_time_3','$message')"; $Insert_Run_1 = mysql_query($Insert_Qry_1) or die("Insert query error".mysql_error()); $attachmentfileid_1 = mysql_insert_id(); if($_FILES['file']['name']!="") { $size = 190; // the thumbnail height $filedir = 'uploads/'; // the directory for the original image $thumbdir = 'uploads/'; // the directory for the thumbnail image $maxfile = '200000000000'; $mode = '0666'; $userfile_name = $_FILES['file']['name']; $userfile_tmp = $_FILES['file']['tmp_name']; //$userfile_name = $_FILES['uploadFile']['name']; //$userfile_tmp = $_FILES['uploadFile']['tmp_name']; $getExt = explode ('.', $userfile_name); $rand_name = md5(rand(000,999)); /* $prod_img = $filedir.$mysql_insert_id.$i.$getExt[0].".".$getExt[1];*/ $new_file_name = $userfile_name; //exit(); $new_file_name = str_replace('&','and',$new_file_name); $new_file_name = str_replace('#','',$new_file_name); $new_file_name = str_replace('+','',$new_file_name); $new_file_name=($attachmentfileid.$new_file_name); $prod_img = $filedir.$new_file_name; // original_images/456546565465465464jhh.jpg $items[] = $prod_img; $prod_img_thumb = $thumbdir.$getExt[0].".".$getExt[1]; move_uploaded_file($userfile_tmp, $prod_img); $upload_img = mysql_query("UPDATE tbl_appointment SET document_name='".$new_file_name."' WHERE id='".$attachmentfileid_1."'"); } } ?>