Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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);

like image 447
Rakib Roni Avatar asked Apr 02 '26 00:04

Rakib Roni


2 Answers

Try:

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

Your method:

function sendVerificatinEmail($name, $email, $request_tracking_no){
    //...
}
like image 66
Mudshark Avatar answered Apr 03 '26 15:04

Mudshark


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
like image 32
ganji Avatar answered Apr 03 '26 15:04

ganji



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!