query($sql_search_order); if ($result->num_rows > 0) { echo ""; }else{ $sql=" INSERT INTO complaint_forms ( complaint_id, form_name, applicant_name, mobile_number, email_id, order_id, transaction_date, transaction_amount, complaint_details, form_created_date ) VALUES ( '".$complaint_id."', 'Complaint Form', '".$_POST["applicant_name"]."', '".$_POST["mobile_number"]."', '".$_POST["email_id"]."', '".$orderId."', '".$_POST["transaction_date"]."', '".$_POST["transaction_amount"]."', '".$message."', '".$date."' )"; if(!$result = $conn->query($sql)){ die('There was an error running the query [' . $conn->error . ']'); } else { $sql = " INSERT INTO complaint_timeline ( meta_id, meta_name, meta_description, meta_user, meta_type, form_created_on, form_created_time ) VALUES ( '".$complaint_id."', 'complaint form', '".$message."', '".$_POST["applicant_name"]."', 'out', '".$form_created_on_date."', '".$form_created_on_time."' ) "; $result = $conn->query($sql); if ($result) { $post = [ 'business' => 'MSME', 'complaint_id' => $complaint_id, 'form_name' => 'Complaint Form', 'applicant_name' => $_POST["applicant_name"], 'mobile_number' => $_POST["mobile_number"], 'email_id' => $_POST["email_id"], 'order_id' => $_POST["order_id"], 'transaction_date' => $_POST["transaction_date"], 'transaction_amount' => $_POST["transaction_amount"], 'complaint_details' => $message, // 'website' => 'UDYOGADHARCERTIFICATE.IN' 'website' => strtoupper($_SERVER['SERVER_NAME']) ]; if ($_SERVER['HTTP_HOST'] == 'localhost') { $ch = curl_init('http://localhost/crm2.techlounge.co.in/api/complaint-new.php'); } else { $ch = curl_init('https://crm2.techlounge.co.in/api/complaint-new.php'); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $response = curl_exec($ch); curl_close($ch); //echo $response; if ($_SERVER['HTTP_HOST'] == 'localhost') { $ch = curl_init('http://localhost/crm11.techlounge.co.in/api/complaint-new.php'); } else { $ch = curl_init('https://crm11.techlounge.co.in/api/complaint-new.php'); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $response = curl_exec($ch); curl_close($ch); header ('location: ./complaint-success.php?complaint_id='.$complaint_id.''); } } } } ?>