Cookies or URL Parameters to save data from previous page?
Hello,
I have multi page registration page,
So the user start when he select the plan, after that his goal and other things
- Plan Type.
- Plan duration.
- His Goal.
- Some data like: his weight, age , tall, etc...
- The user will selects some meals for his plan.
- registration form.
so i need to collect all these data until he reach to register form and finish the registration. after that i can insert all the data in database.
What is the best way to save all that data?
is it the Cookies or in url Parameters? in laravel 8?
Thanks.
best way use session
session()->put('key', 'value');
store multi data into session
session()->put(['key'=> 'value', 'key2' => 'value2']);
get session
session()->get('key')
forget session
session()->forget('key');
It will definitely help you
https://laraquiz.com/
@johnDoe220 can i save objects and arrays in the sessions?
Yes sure,for example
$posts = Post::all();
session()->put('posts', $posts);
dd(session()->get('posts'));
Please or to participate in this conversation.