Reputation: 5669
I have a list with 17 rows with form values, where you can select multiple items with a checkbox and write in a text field on every row next to the checkbox, and I'm trying to insert the two values into the db but I only get what I have selected in the checkbox, not what I have written in the text field?
My formpage looks like this:
sql = "SELECT * FROM menu;"
set rs = conn.Execute(sql)
i = 0
do until rs.eof %>
<input type="text" name="newheadline" value="">
<input type="checkbox" name="menu_id<%=i%>" value="<% = rs("menu_id") %>">
<% i = i + 1
rs.movenext
loop %>
And on page2 I try to loop trough it and here I only get the value of the checkbox, not the value of the newheadline
?
i = 0
do until i = 17
response.write (request.form("menu_id"&i))
response.write (request.form("newheadline"&i))
i = i + 1
loop
What am I missing? Thanks!
Upvotes: 0
Views: 1611
Reputation: 91600
You write out your textbox like:
<input type="text" name="newheadline" value="">
But you try to read it like:
response.write (request.form("newheadline"&i))
You'll need to append the value of i
onto each name attribute, exactly like you do with your checkbox:
<input type="text" name="newheadline<%=i%>" value="">
Upvotes: 3