Re: From form to db question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux