Psyduck - 可達鴨 之 鴨力山大

Current Path : home/irplbiz/public_html/maackolkata/
Upload File :
Current File : /home/irplbiz/public_html/maackolkata/process_form.php

<?php


if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = $_POST['name'];
    $mobile = $_POST['mobile'];
    $email = $_POST['email'];
    $course = $_POST['course'];
    $center = $_POST['center'];
    $query = '';
    
//   print_r($_POST);echo $center;

 //api int LSQ

$curl = curl_init();


$arr = array(

  CURLOPT_URL => 'https://api.leadsquared.com/v2/LeadManagement.svc/Lead.Create?accessKey=u$ra0f30e92847410701660467fe6c63a6a&secretKey=7fb817713c243b546722fd98acaf56d87fb059ba',

  CURLOPT_RETURNTRANSFER => true,

  CURLOPT_ENCODING => '',

  CURLOPT_MAXREDIRS => 10,

  CURLOPT_TIMEOUT => 0,

  CURLOPT_FOLLOWLOCATION => true,

  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

  CURLOPT_CUSTOMREQUEST => 'POST',

  CURLOPT_POSTFIELDS =>'[

    {

        "Attribute": "EmailAddress",

        "Value": "'.$email.'"

    },

    {

        "Attribute": "FirstName",

        "Value": "'.$name.'"

    },

    {

        "Attribute": "Phone",

        "Value": "'.$mobile.'"

    },
    
    {

        "Attribute": "mx_QUERY_DETAILS",

        "Value": "'.$query.'"

    },
    
    {

        "Attribute": "mx_MAAC_Branches",

        "Value": "'.$center.'"

    },
   {

        "Attribute": "Source",

        "Value": "MAAC KOLKATA WEBSITE"

      }
    
    
    

]',

  CURLOPT_HTTPHEADER => array(

    'Content-Type: application/json'

  )

);

curl_setopt_array($curl, $arr);

$response = curl_exec($curl);
// print_r($arr);
// print_r($response);
curl_close($curl);

//api int LSQ

    // Validate email
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        echo "Invalid email format";
        exit();
    }
  

    // Send email to admin
    //$to = "enquiry@animationkolkata.com"; // Change this to your admin email
    //$to = "info@animationkolkata.com, maacanimationkolkata@gmail.com, maackolkata@gmail.com, enquiry@animationkolkata.com";
      $tooemail='';
    if($center=="1")
    {
        $tooemail=", chowringhee@maacmail.com";  
    }
     if($center=="2")
    {
          $tooemail=", rashbehari@maacmail.com";
    }
     if($center=="3")
    {
          $tooemail=", ultadanga@maacmail.com";
    }
    
  
    
    $to = "info@animationkolkata.com, maacanimationkolkata@gmail.com, maackolkata@gmail.com, enquiry@animationkolkata.com".$tooemail;
    $from="it@maackolkata.com";
    $headers .= "Content-type: text/html; charset=utf-8"."\r\n";
    $headers .= "From: Maac kolkata <".$from.">" . "\r\n";  
    $headers .= "MIME-Version: 1.0 \r\n";
    $headers .= "Reply-To: The Sender <".$from.">\r\n"; 
    $headers .= "Return-Path: The Sender <".$from.">\r\n";
    $subject = "New Registration";
    $message = "Name: $name\nMobile No: $mobile\nEmail ID: $email\nCourse: $course\nCenter: $center";


    
    
    // ini_set('display_errors', 1);
    // ini_set('display_startup_errors', 1);
    // error_reporting(E_ALL);
    // Send email
    if (mail($to, $subject, $message, $headers)) {
        // Redirect to thank you page
        header("Location: thankyou.php");
        exit();
    } else {
        echo "Oops! Something went wrong.";
    }
}
?>