Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

textbox with a variable added to the name.

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
I have a form below that I am showing individual records using a do while loop. In my page I am setting a variable called x. In the text field below I want the name of the text field to be hour plus whatever x equals. so an example would be "hour1" can someone tell me how I would write this

<%dbrs2.movefirst %>
<%
dim x = 1
%>
<% Do While NOT dbrs2.EOF %>
<tr>
<td><%=(dbrs2.Fields.Item(&quot;month&quot;).Value)%></td>
<td><%=(dbrs2.Fields.Item(&quot;date&quot;).Value)%></td>
<td>
<input type=&quot;text&quot; name=&quot;hour&quot;<%=x%> value=&quot;<%=(dbrs2.Fields.Item(&quot;hour&quot;).Value)%>&quot;>
</td>
<td><%=(dbrs2.Fields.Item(&quot;code&quot;).Value)%></td>
</tr>
<%dbrs2.movenext %>
<%x = x + 1%>
<%Loop%>
 
Just move your quote to the outside of the x value:

<input type=&quot;text&quot; name=&quot;hour<%=x%>&quot; value=&quot;<%=(dbrs2.Fields.Item(&quot;hour&quot;).Value)%>&quot;>

That should fix it up.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top