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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with request.form

Status
Not open for further replies.

SonJ

Programmer
Oct 24, 2002
166
GB
Hi there

Can anyone see what I am doing wrong? I am using SQL Server 2000 and ASP

This is how I am calling my function:

<select name=&quot;blah&quot;>
<%WriteShowTime=ShowTime(&quot;intDepartureMinuteOption&quot;, strDepartureMinute, 0, 59, 5)%>
</select>

and this is my function here:

function ShowTime(strLoopVariable, strConstantVariable, intStartFrom, intEndAt, intStep)
for strLoopVariable=intStartFrom to intEndAt step intStep
if strLoopVariable<10 then strLoopVariable=&quot;0&quot; & strLoopVariable
Response.Write &quot;<option value=&quot;&quot;&quot; & strLoopVariable & &quot;&quot;&quot;&quot;
if strLoopVariable=strConstantVariable then Response.Write &quot; SELECTED&quot;
Response.Write &quot;>&quot; & strLoopVariable & &quot;</option>&quot;
next
end function

The problem that I am getting is that it is very temperamental as to whether it will do the &quot;Selected&quot; part of the loop.

If anyone has any ideas as to what I am doing wrong, your advice, hints, tips would be much appreciated.

Thanks in advance
 
try forcing both values to an Int before comparing them - ie:
Code:
if CInt(strLoopVariable)=CInt(strConstantVariable) then Response.Write &quot; SELECTED&quot;
Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Thanks for that, it worked a treat.

What can I say, sometimes the most obvious answer eludes us all!

SoniaD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top