简体   繁体   English

将表单值从一个表单/页面传递到另一表单/页面-Laravel

[英]Passing form value from one form/page to another - Laravel

Here is an explanation of my question. 这是我的问题的解释。

I have 2 forms: add & add1 我有2种形式: add&add1

2 pages: add.php & add1.php 2页: 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. 2个功能:用户填写并提交表单add后,函数post_add和函数post_add1会自动重定向到用户到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. 形成add1 ,因为您需要在下一个表单中键入相同的内容。

Thanks in advance! 提前致谢!

Just use Session::flash(); 只需使用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().... 或者,您也可以使用with()...。

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

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

  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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