Re: From form to db question
| From: | Richard Lynch | Date: | Sun, 24 Apr 2005 23:34:09 +0000 |
| Subject: | Re: From form to db question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-213762@lists.php.net to get a copy of this message | ||
On Sun, April 24, 2005 3:26 am, William Stokes said:
> I writing a script that allows user to update a soccer league table with
> web
> form. I made a script that prints the old values to text fields in the
> form.
> It's done with a loop so that each text field name is numbered +1 higher
> than previous.
Change the NAME to something like:
NAME="new_games[$i]"
where $i goes from 1 to 14.
That way, you'll have an array called $new_games to work with.
Then you can use a for loop like:
$new_games = $_POST['new_games'];
while (list($i, $value) = each($new_games)){
$query = "update x_series set games = '$value' where name =
'$team$i'";
}
Sending 14 queries is no big deal... But you wouldn't want to do like,
100...
This is actually answered in the FAQ.
http://php.net/faq.php
--
Like Music?
http://l-i-e.com/artists.htm