Codeigniter Example
Screen shot
View : Save application->view->viewnumber.php
<html>
<head>
<title>CodeIgniter Basic Example</title>
</head>
<body>
<?php
if(isset($number3))
echo $number3;
?>
<form name="frm" action="<?php echo base_url(); ?>Addnumber/add" method="post">
Enter Number1<input name="number1" type="text" value=""/><br>
Enter Number2<input name="number2" type="text" value=""/><br>
<input name="btn" type="submit" value="Submit"/>
</form>
</body>
</html>

Controller : Save application->controllers->Addnumber.php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Addnumber extends CI_Controller {

public function __construct(){
parent::__construct();
$this->load->helper('url');
$this->load->model('addmodel');
}

public function index()
{
$this->load->view('viewnumber');

}
public function add()
{

$number1=$this->input->post('number1');
$number2=$this->input->post('number2');
$number3=$this->addmodel->add($number1,$number2);
$data['number3']=$number3;
$this->load->view('viewnumber',$data);
}
}

Models : Save application->models->Addmodel.php
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Addmodel extends CI_Model{

public function add($x,$y){
return $x+$y;
}

}
?>