Jump to content

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


kiki57

Recommended Posts

Bonjour,

 

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">	

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

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

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]);
[spam-filter]

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...