<?php

class Contactform extends CI_Controller {

public function index(){
	$to = "niharika@karmasource.net"; 
    $from = $_REQUEST['email11']; 
    $fullname = $_REQUEST['name11']; 
    $headers = "From: $from"; 
    $subject = "You have a message sent from your site"; 

    $fields = array(); 
    $fields{"name11"} = "Name";     
    $fields{"phone11"} = "Number"; 
    $fields{"email11"} = "Email";
    $fields{"order11"} = "Order Number";
    $fields{"message"} = "Message";

    $body = "Message Body:\n\n"; foreach($fields as $a => $b){   $body .= sprintf("%s: %s\n",$b,$_REQUEST[$a]); }

    $send = mail($to, $subject, $body, $headers);

    $current  = $_SERVER['REQUEST_URI'];
    
    //session_start();
    $_SESSION["url"]=$_SERVER['REQUEST_URI'];
    
    //$previousUrl = $_SERVER['HTTP_REFERER'];
    $previousUrl = base_url()."thankyou";
    
    header('Location: ' . $previousUrl);

}

}
?>