I'm having trouble inserting multiple rows into a database.

Here's my html for the form:
<form class="form-horizontal" role="form" method="post" action="add">
<div class="form-group">
$ loopcount = 1
$for players in playersdb:
$if players.teamname == schedule.team1:
<label>$players.firstname $players.lastname</label>
     <div><input type="number" name="$:{loopcount}inputGameplayed" 
placeholder="0" min="0" max="1"></div>
<div><input type="number" name="$:{loopcount}inputTDs" placeholder="0" 
min="0"></div>
$ loopcount = loopcount + 1
        <div><input type="hidden" name="loopcount" class="form-control" 
id="loopcount" value="$loopcount"></div>
        <input type="submit" value="Add" />
</div>
</form>


Add here's here's the web.py code for posting the form data to the db:

class add:
    def POST(self):
i = web.input()
loop_int = int(i.loopcount)
for j in range(loop_int):
        n = db.insert('statistics', gameplayed=i.(%d) inputGameplayed % j, 
touchdowns=i.'%d inputTDs % j)
        raise web.seeother('/admin/gameselect')


I'm getting an invalid syntax error for "i.(%d)inputGameplayed".
I'm new to python, how can I correctly insert the loop integer into the 
user form variables?

Or, even better, is it easier to use db.multiple_insert in this case?
I've looked into it, but can't figure out how to correctly create the 
arrays from the data.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to