<?php

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

class Front extends CI_Controller {

    public function index() {

$data['slider']=$this->db->where('status','Active')->order_by('id','desc')->limit(16)->get('slider')->result_array();
        $this->load->view('index',$data);

    }

    public function aboutus() {

        $this->load->view('about-us');

    }

  public function contactus()
  {
    $data['programe'] = $this->db->order_by('sort','desc')->get('programe')->result_array();
    $this->load->view('contact-us',$data);
  }

  public function whyus()
  {
    $this->load->view('why_us');
  }

  public function check_out()
  {
     
    $this->load->view('checkout');
  }


   public function programes(){


  $data['programe'] = $this->db->order_by('sort','desc')->get('programe')->result_array();

  $this->load->view('programe',$data);
 }


   public function programe_details($id=""){
      
    $data['programe'] = $this->db->where(array('id'=>$id,'status'=>'Active'))->get('programe')->row_array();
  $this->load->view('programe_detail',$data);
}

public function choose_dates()
{
  //print_r($_POST);exit;
  $data['post']=$this->db->select('*')->from('programe')->where('id',$_POST['id'])->get()->row_array();
  $this->load->view('choose_dates',$data);
}


   public function filldetail()
  {
    
    $this->load->view('fill_detail',$_POST);
  }

   public function terms()
  {
   
    $this->load->view('terms_condition');
  }


  public function contact()
  {
      if(!empty($_POST))
        {
            
            unset($_POST['submit']);
        foreach($_POST as $key=>$val)
        {
        $arr[]= $key.": ".$val."      " ;
        
        }
        $str=implode('',$arr);
        $msg=$str;
        
     
        $to="ttrailhunters@gmail.com";
        $subject="Query On Website";
        $header="Website Query";
       
        
        if(mail($to,$subject,$msg,$header))
        {
        
        echo "<script type='text/javascript'>alert('Thanks. Mail Sent'); window.location='".base_url()."';</script>";
        }
        else
        {
        
        echo "<script type='text/javascript'>alert('oops! Error occured.'); window.location='".base_url()."';</script>";
        
        
        }
        
        
        }
  }





    

    
}