1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
<?php //mon controleur du formulaire
public function indexAction()
{
// construction formulaire recherche clients
$membre = new Membre;
$formBuilder = $this->createFormBuilder($membre);
$formBuilder
->add('nom', 'text');
$formmembre = $formBuilder->getForm();
$request = $this->get('request');
// On vérifie qu'elle est de type POST & on la récupère
if ($request->getMethod() == 'POST') {
$formmembre->bind($request);
// On vérifie quel formulaire a été remplit et on redirige
if ($formmembre->isValid()) {
return $this->redirect($this->generateUrl('rech_membre', array('nom' => $membre->getNom())));
}
}
return $this->render('GestionIndexBundle:Default:indexGestion.html.twig', array('formmembre' => $formmembre->createView()));
} |