1

I want to put my input field into Session, it's a POST request But field which I'm taking as input through form will not store into database. How do I set it to Laravel Session.

<input id="moneyReceived" name ="moneyReceived" onchange="payable()" type="text">

{{ Session::put('moneyReceived', $_POST['moneyReceived']) }}

Though It's not stored in Session! Can anyone suggest please?

3
  • share more about how you interact with moneyReceived in your controller ? Commented Jan 21, 2017 at 8:44
  • actually I don't store moneyReceived in controller. It's just javascript dependent input field.based on previous input! Commented Jan 21, 2017 at 9:05
  • 1
    The session object is only available on the server side. Commented Jan 21, 2017 at 9:22

1 Answer 1

0

Data from the form is passing to some method. So the method should look like this:

public function store(Request $request)
{
    session(['moneyReceived' => $request->moneyRecieved]);
    ....
}
Sign up to request clarification or add additional context in comments.

1 Comment

actually I don't store moneyReceived in controller. It's just javascript dependent input field.based on previous input!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.