du970294 2018-06-10 09:14
浏览 57
已采纳

如何在Laravel中完成注册后显示用户输入

I am creating a website. In this website, I have created a Form. In this form, users can type their details and submit. When someone clicks submit button all the data stores into the database. But, Now I want to show User Inputs after registration is completed. I mean, there is page A which users can input and when this user clicks submit button I want to redirect that user to page B and show him, his inputs. I have tried this way, and it gives me this error -

ErrorException (E_ERROR) Undefined variable: date (View: D:\wamp64\www\FinalProjectesources\views\addmoney\paywithpaypal.blade.php)

How can I Fix this ??

Form View Page Book.blade.php

<form class="form-horizontal" id="form1" method="POST" action="{{ route('booktsinsert') }}"
          enctype="multipart/form-data">

        {{ csrf_field() }}

            <h4><span id="success_message" class="text-success"></span></h4>

        <br>
            <h4 style="font-family: Times New Roman;font-size:200%;color:blue;"> Book {{ $bk->title }} Movie </h4> <br>

            <input type="hidden" name="Movieid" value="{{ $bk->id }}">

            <div class="form-group row">
                <label for="example-date-input" class="col-2 col-form-label">Select Date :</label>
                <div class="col-10">
                    <input class="form-control" type="date" name="date" placeholder="mm-dd-yyyy"
                           id="example-date-input">
                </div>
            </div>
</form>

Redirect View page. ( paywithpaypal.blade.php )

<h1> {{$date}} </h1>

Controller page. ( BookSeatController.php )

public function booktsinsert(Request $request)
    {

        $Mid = $request->input('Movieid');
        $date = $request->input('date');
        $st = $request->input('st');
        $sendemail = $request->input('email');

                $user = new BookSeat();
                $user->Movie_id = $Mid;
                $user->sdate = $date;
                $user->stime = $st;
                $user->email = $sendemail;

                $user->save();
            }
            return redirect('paywithpaypal')->with("date", $date);
        }
    }

Routes.

Route::post('booktsinsert', [
    'uses' => 'BookSeatController@booktsinsert',
    'as' => 'booktsinsert'
]);

Route::get('paywithpaypal', array('as' => 'addmoney.paywithpaypal','uses' => 'AddMoneyController@payWithPaypal',));
  • 写回答

3条回答 默认 最新

  • dounielong7728 2018-06-10 09:22
    关注

    try

    return redirect('paywithpaypal')->with("date", $date);
    

    instead of this

    return view('paywithpaypal', ['date' => $date]);
    

    I hope this will help...

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 请问为什么我配置IPsec后PC1 ping不通 PC2,抓包出来数据包也并没有被加密
  • ¥200 求博主教我搞定neo4j简易问答系统,有偿
  • ¥15 nginx的使用与作用
  • ¥100 关于#VijeoCitect#的问题,如何解决?(标签-ar|关键词-数据类型)
  • ¥15 一个矿井排水监控系统的plc梯形图,求各程序段都是什么意思
  • ¥15 ensp路由器启动不了一直报#
  • ¥50 安卓10如何在没有root权限的情况下设置开机自动启动指定app?
  • ¥15 ats2837 spi2从机的代码
  • ¥200 wsl2 vllm qwen1.5部署问题
  • ¥100 有偿求数字经济对经贸的影响机制的一个数学模型,弄不出来已经快要碎掉了