Re: Submitting several forms

From: Date: Mon, 09 Feb 2004 11:42:00 +0000
Subject: Re: Submitting several forms
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-177194@lists.php.net to get a copy of this message
make it one form and name the form elements using [], they will become arrays. example: <form > <input type="text" name="name[1]" value="....."> <input type="text" name="surname[1]" value="....."> <input type="text" name="name[2]" value="....."> <input type="text" name="surname[2]" value="....."> the numbers (1 and 2) are ids of the records. then you loop the array and update the rows: foreach($_POST['name'] as $id => $null) { update table set name='{$_POST['name'][$id]}', surname='{$_POST['surname'][$id]}' where id='$id' } Chitchyan, Ruzanna wrote:
Hi all I have the following problem: I want to allow users to update a number of records either one by one, or all together. Currently I have put each record in a separate form on a page and each form can be updated separately, but I don't know how to allow simultaneous update of all forms (without reverting to JavaScript). Any help is greatly appreciated. Thanks Rouza


« previous php.general (#177194) next »