You are here: Re: [PHP] From form to db question « PHP « IT news, forums, messages
Re: [PHP] From form to db question

Posted by Richard Lynch on 10/12/49 11:14

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация