On Mon, Jun 24, 2002 at 11:23:11PM +0200, Martin Kampherbeek wrote:

> Now I've got a form with the matches for that weekend and some
selectboxes with 1 to 9 for the goals. At the bottum of the form is a
Submit button. What I want is to insert all the scores in my table
predictions with just that one button.
> 
> Table predictions:
> id
> date
> homeclub
> awayclub
> endhome
> endways
> halftimehome
> halftimeaway
> 
> So why knows how to insert all the scores for all the selected matches
in my table predictions with just that one button?


Dude, turn line wrapping on in your email client.

Anyway, Make the form elements:

<form>
 <input type="text" name="info[33][endaway]" />
 <input type="text" name="info[33][endhome]" />
</form>

"33" there is the game id.

Your receiving script should then use a while loop to go through each info
to get the game number and then use the second dimension info[gameid] to
get the data out.  Here's some off of the top of the head, untested 
code you can use as PART of your system...

while ( list($ID,) = each($_POST['info']) ) {
   $querystring  = 'INSERT INTO table (endaway, endhome) VALUES (';
   $querystring .= $_POST['info'][$ID]['endaway'] . ', ';
   $querystring .= $_POST['info'][$ID]['endhome'] . ')';

   # execute query now via appropriate function.

}

--Dan

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409

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

Reply via email to