Rakib Roni
Rakib Roni

Reputation: 244

Multiple parameter pass in redirect function

I want to pass multiple parameters to a function in same controller.Here is my redirect function when i run this code then show warning.

Message: Missing argument 2 for Welcome::sendVerificatinEmail()

redirect('welcome/sendVerificatinEmail/'.$name,$email ,$request_tracking_no);

Upvotes: 3

Views: 7383

Answers (2)

ganji
ganji

Reputation: 854

In Codigniter during redirection all post data will destroy and you have to use session variables to send data. try this: I hope help

$data = array('param1'=>'ali','param2'=>55);
// store data to flashdata
$this->session->set_flashdata('data',$data);
// redirect  to your controller
redirect('controller/method')  
//in other side
$array = $this->session->flashdata('data');

actually Codeigniter uses $_SESSION and you can use directly of sessions instead of flash data like this:

//first
$_SESSION['flash'] = implode('@',array(a,b,c));
//then
$flash = $_SESSION['flash'];
$array = explode('@',$flash);
unset($_SESSION['flash']); //free it

Upvotes: 1

Mudshark
Mudshark

Reputation: 3253

Try:

redirect('welcome/sendVerificatinEmail/'.$name.'/'.$email.'/'.$request_tracking_no);

Your method:

function sendVerificatinEmail($name, $email, $request_tracking_no){
    //...
}

Upvotes: 4

Related Questions