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

class Home extends CI_Controller {
	public function __construct(){
        parent::__construct();
        	$this->load->model('mod_home');
        	
       }
  public function index()
	{
		if($this->input->post('submit')=='Submit'){
			    $this->form_validation->set_rules('name', 'Name', 'required');
				$this->form_validation->set_rules('email', 'Email', 'required');
				$this->form_validation->set_rules('mobile', 'Mobile', 'required');
				if ($this->form_validation->run() == FALSE){
					$err = validation_errors();
				}else{
					 $da = $this->mod_home->setdata($this->input->post());	
					 if($da!=''){
					 	redirect('Thankyou');
					 }	
					}
			}
		if($this->input->post('submit')=='Submit1'){
			    $this->form_validation->set_rules('name1', 'Name', 'required');
				$this->form_validation->set_rules('email1', 'Email', 'required');
				$this->form_validation->set_rules('mobile1', 'Mobile', 'required');
				if ($this->form_validation->run() == FALSE){
					$err = validation_errors();
				}else{
					 $da = $this->mod_home->setdata1($this->input->post());	
					 if($da!=''){
					 	redirect('Thankyou');
					 }	
					}
			}
		if($this->input->post('submit')=='Submit2'){
			    $this->form_validation->set_rules('name2', 'Name', 'required');
				$this->form_validation->set_rules('email2', 'Email', 'required');
				$this->form_validation->set_rules('mobile2', 'Mobile', 'required');
				if ($this->form_validation->run() == FALSE){
					$err = validation_errors();
				}else{
					 $da = $this->mod_home->setdata2($this->input->post());	
					 if($da!=''){
					 	redirect('Thankyou');
					 }	
					}
			}		
		$this->load->view('welcome_message');
	}
}
