Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ramher101's avatar

Session question

Is there something I need to know with session variables and textboxes?

Whenever I save radioboxes, checkboxes, and dropdowns in the session it works perfectly (I check it in the debugbar plugin)

But when I save something coming from textboxes it doesn't save it always.. sometimes it gets it sometimes it dont. I always output in console log the success function when I use ajax in sending to session and I can see that its perfect but when I refresh the page its not always in the session variable

here is the part where i retrieve the success function

        session(["credit-investigation.".$loan_id.".".$category.".".$html_id => $html_values]);

        $val = Session::get("credit-investigation.".$loan_id.".".$category.".".$html_id);        
        return Response::json($val);

0 likes
2 replies
bipin's avatar

@ramher101 try this

   Session::put('variableName', $Request->input('name of input'));

to check

 Session::get('variableName');
  
ejdelmonico's avatar

Are you storing strings? You need to store strings I believe. The key doesn't appear to be a string. You should add a pair of single quotes around the concat for the key and try that. Also, why not use the global helpers instead of the facade. It is more readable.

Please or to participate in this conversation.