Jump to content

Récupérer les variables d'un formulaire (boucle)


Recommended Posts



Je souhaite récupérer les variables d'un formulaire créé en BO et modifier ma BDD


Voila mon formulaire .tpl:

	<form action="#" method="post">	

				<th>{l s='Id'}</th>
				<th>{l s='specialité'}</th>
		<tbody> <!-- Corps du tableau -->
			{foreach key=k item=i from=$tableau}
				<td><input type="text" name="id-[]" value="{$i.id_customer}"/></td>
				<td><input type="text" name="speciality-[]" value="{$i.speciality}"/></td>

				<td>{l s='Aucun élément n\'a été trouvé dans la recherche'}</td>
	<br /><input  name="submit" type="submit" value="" /><br />

mon .php pour le traitement

if (Tools::isSubmit('submit'))

foreach(Tools::getValue('id-') as $i=>$val) {

  Db::getInstance()->execute('UPDATE `'._DB_PREFIX_ .'customer`
	SET `speciality` = '.Tools::getValue('speciality-')[$i].'
	WHERE `id_customer` = '.Tools::getValue('id-')[$i]);

mais impossible de modifier ma table, pouvez-vous m'aider?

Edited by kiki57 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...