简体   繁体   中英

Passing form value from one form/page to another - Laravel

Here is an explanation of my question.

I have 2 forms: add & add1

2 pages: add.php & add1.php

and 2 functions: function post_add & function post_add1 when the user has fill and submit the form add, function post_add automatically redirect to user to add1.

I want to pass value (after the user fill it and submit it) from form add

"echo Form::text('name', Input::get('name'));"

to form add1 , because you need to type the same thing on next form.

Thanks in advance!

Just use Session::flash();

Like so...

 function post_add(){
 //blah blah your code.
 $passvalues = Input::all();
 Session::flash('values', $passvalues);     
 Redirect::to('/add1');

  }

  function post_add1(){
  //Now you have access to that input...

  $oldinput = Session::get('values');
  //do whatever you need to with the old/passed input
  }

Or you could just do a with()....

     function post_add(){
 //blah blah your code.
 $passvalues = Input::all();

 Redirect::to('/add1')->with('values', $passvalues);

  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM