@wilmer.lemke
To get form data with session in Symfony, you can follow these steps:
1
|
$form = $this->createForm(UserType::class); |
1 2 3 4 5 6 7 8 9 |
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$formData = $form->getData();
// Store form data in session
$this->get('session')->set('formData', $formData);
return $this->redirectToRoute('next_route');
}
|
1
|
$formData = $this->get('session')->get('formData');
|
With these steps, you can easily get form data with session in Symfony form.