Click here to Skip to main content
15,039,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey currently using laravel and what im trying to do is to get the id that is in the URL and use it to access the data in the database. But it seems that in forms it cannot be done? since I've done it in a get method.

here is the code for the controller. can someone help me with this I've been stuck here for days.

ublic function evalstudap(Request $request) {
        
        $start = $request->start;
        $end = $request->end;
        $date = $request->date;
        $message = $request->message;
        $transno = request('id');
        $user = DB::table('studapforms')->where('transno', $transno)->first();

        if(empty($start)&&empty($end)&&empty($date)&&empty($message)) {
            return redirect()->back()->with('message', "Input fields must be filled up.");
        }else {
            if($user) {
                MailController::notifeval($user->email, $start, $end, $date, $message);
                return redirect()->back()->with('emessage', "Student Has been notified");
            }else {
                return redirect()->back()->with('emessage', "error");

            }

        }

        return view('/studap/admin/evalstudap ', ['list' => $user]);
    }


What I have tried:

ive tried using different kinds of request methods but still the same
Posted
Updated 8-Jul-21 2:48am

1 solution

According to the docs, the method call you're looking for is $request->query('id');.
   
Comments
My Jinji 8-Jul-21 8:55am
   
sorry but when i put dd() in it, it says null

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900