Forum Moderators: phranque
i have probably a rather peculiar question...usually what i wish to do is the opposite of what most web designers want (lol!), BUT what i wish to do is when a user enters in data in a form and submits it (only once), that data gets posted to the database +times based on the number they enter in the "how many did you purchase?" field. in other words, this field will determine HOW MANY times that data is re-submitted to the database. for example...if the user enters in they bought 3 items, then the data they submit (by only hitting the submit button once) will be entered into the database table tblRegistration 3 times, with a unique id for each entry.
the reasoning behind this is this is for a contest, so the user could be entered in the contest +times based on the number of items they purchased.
i have a submit.asp page that grabs that data from my form.asp page and submits to my database...this is the code in my submit.asp i tried hoping it would do what i wanted but to no avail (it submits the data but only once):
i = Request.Form("number")
Do while i > 0
sSQL = "INSERT into tblRegistration(DateSubmitted, FirstName, LastName, CompanyName, AmountOnOrder, OrderNumber) values ('" & dateSubmitted & "', '" & firstName & "', '" & lastName & "', '" & companyName & "', '" & numberOnOrder & "', '" & orderNumber & "')"
i = i - 1
Loop
All advice welcomed! Thank you kindly!
Kind regards,
Harlequin
that worked perfectly! thank you! :D
raywood...
i'm using an access database.
and yes, i do agree it is redundant, but the contest is more for our dealers so there won't be an enormous amount of entries. but i will definitely consider all of your advice. ;)
i greatly appreciate all of your time and input! thank you! :D
kind regards,
harlequin