<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Contactus extends CI_Controller
{
    public function index()
    {
        if(isset($_POST) && $_POST)
        {
            $data = [
                'name' => $_POST['name'],
                'email' => $_POST['email']
            ];
            $response = apiCall('ContactSubmit',$data);
            if($response['code']==1)
            {
                $this->session->set_flashdata('success', $response['msg']);
                redirect('contact');
            }
            else
            {
                $this->session->set_flashdata('error', $response['msg']);
                redirect('contact');
            }
        }

        // p($response);
        renderView($this,'contact/index');
    }
}
