R
Rhyno
Hi there
I'd like to have a single form insert multiple records/rows to a table using
a single form.
The form is used for members to refer their friends. The member enters their
Username and then the email addresses of up to 3 friends.
The first page (form1.asp) includes the following form:
<form method="POST" action="form2.asp">
<p>Username
<input type="text" name="username" size="20"></p>
<p>1st Mate's Email
<input type="text" name="matesemail1" size="20"></p>
<p>2nd Mate's Email
<input type="text" name="matesemail2" size="20"></p>
<p>3rd Mate's Email
<input type="text" name="matesemail3" size="20"></p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
This form posts to the second page (form2.asp), which inserts to the Access
DB using an ASP script.
The table which holds the results has two fields: 'Username' and
'MatesEmail'. As you'll see, the ASP code below would insert one record to
the table. I'd like to modify the code to insert into three records, each
with the Username and one of the 3 email addresses.
<%
Dim name, email
Dim sConnString, connection, sSQL
sSQL = "INSERT INTO results (Username, MatesEmail) values ('" &
request.form("username") & "', '" & request.form("matesemail") & "')"
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("\fpdb\test1.mdb")
Set connection = Server.CreateObject("ADODB.Connection")
connection.Open(sConnString)
connection.execute(sSQL)
response.write "The form information was inserted successfully."
connection.Close
Set connection = Nothing
%>
I/m not great with coding, so if anyone has the time to actually modify the
code for me it'd be greatly appreciated.
Thanks in advance!
Ryan
I'd like to have a single form insert multiple records/rows to a table using
a single form.
The form is used for members to refer their friends. The member enters their
Username and then the email addresses of up to 3 friends.
The first page (form1.asp) includes the following form:
<form method="POST" action="form2.asp">
<p>Username
<input type="text" name="username" size="20"></p>
<p>1st Mate's Email
<input type="text" name="matesemail1" size="20"></p>
<p>2nd Mate's Email
<input type="text" name="matesemail2" size="20"></p>
<p>3rd Mate's Email
<input type="text" name="matesemail3" size="20"></p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
This form posts to the second page (form2.asp), which inserts to the Access
DB using an ASP script.
The table which holds the results has two fields: 'Username' and
'MatesEmail'. As you'll see, the ASP code below would insert one record to
the table. I'd like to modify the code to insert into three records, each
with the Username and one of the 3 email addresses.
<%
Dim name, email
Dim sConnString, connection, sSQL
sSQL = "INSERT INTO results (Username, MatesEmail) values ('" &
request.form("username") & "', '" & request.form("matesemail") & "')"
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("\fpdb\test1.mdb")
Set connection = Server.CreateObject("ADODB.Connection")
connection.Open(sConnString)
connection.execute(sSQL)
response.write "The form information was inserted successfully."
connection.Close
Set connection = Nothing
%>
I/m not great with coding, so if anyone has the time to actually modify the
code for me it'd be greatly appreciated.
Thanks in advance!
Ryan