'Save input value in session and then print variable
is it possible to pass the value of an input with session? i need to pass the value 25 and then save to session
Ej:
Blade.php:
<input type="hidden" name="idevento" value="25">
Controller:
session(['variableName' => $request->input("idevento")]);
Then I get the value with:
$save_value = Session::get('variableName');
the problem is that it does not save the value, help pls
Solution 1:[1]
For store session value you would use:
Session::put('variableName', $request->input("idevento"));
To get the variable, you would use:
Session::get('variableName');
Solution 2:[2]
i use $variable=Session::get('variableName'); but prints the conten of variableName instead save it into $variable
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | VIKAS KATARIYA |
| Solution 2 | ariel |
