Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
PHP
public function evalstudap(Request $request) {
        
        $start = $request->start;
        $end = $request->end;
        $date = $request->date;
        $message = $request->message;
        $id = $request->input('id');
        $user = DB::table('studapforms')->where('transno', $id)->first();

        if(empty($message)&&empty($start)&&empty($end)&&empty($date)) {
            return redirect()->back()->with('message', "Input fields must be filled up.");
        }else {

            if($user) {
                MailController::notifeval($user->email,$request->start, $request->end, $request->date, $request->message);

                return redirect()->back()->with('emessage', "Student has been notified");
            }else {
                return redirect()->back()->with('message', "Refresh the page and try again");
            }
        }

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


What I have tried:

i still havent thought of an alternative for this one. ive been stuck here for days now please help me
Posted
Updated 9-Jul-21 2:13am
v2
Comments
Richard MacCutchan 9-Jul-21 7:11am    
You need to check exactly what values are in those fields at the time this function is called. The fact that all are empty is suspicious as it suggests that $request has not been set correctly. Also, if all fields must be filled in then your test should really be using the or (||) operator, rather than &&.
My Jinji 10-Jul-21 2:10am    
ive echoed all of the variable and all of them displays the correct value that the user inputs. I've done the || but its still the same.
Richard MacCutchan 10-Jul-21 4:02am    
Looking at your new code I cannot see how that could happen. I am afraid I have nothing further that I can suggest.
My Jinji 10-Jul-21 5:27am    
but still thank you so much
Chris Copeland 9-Jul-21 8:14am    
How come you're using $request->input('id') for one field, yet using dynamic properties ($request->message) for the others? Have you tried replacing the dynamic properties with the input() method to see whether you get different results? $request->input('message');

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

  Print Answers RSS


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