Hi there,
I've had a good look around, and can't see a solution to this (or quite possibly, there is a solution, just not one i understand!).
I'm a novice in ASP, so apologies in advance if this is a stupid question
I have a form calling another asp page, with a drop down box and two radio buttons. The drop down list is created via a SQL query, and the radio buttons are used on the following page.
What i'd like to do is change the SQL query, dependant on the radio button chosen. And this is where i have a mental blank.
The code I currently have is:
<form action = "setmaint.asp" method = post>
<%
**SQL CONNECTION BIT**
SQLstr = "SQL String goes here"
rs.open SQLstr, conn
If RS.EOF then
Response.write "<left>There are no records in the table"
Respose.write "<br>please check back later</left>"
Response.end
Else
%>
<p> <select size="1" name="ServerName">
<option>-Select One-</option>
<%
DO WHILE NOT RS.EOF
%>
<option value="<%Response.Write RS("Object_Name")%>"><%Response.Write RS("Object_Name")%></option>
<%
Rs.MoveNext
Loop
End If
%>
</select>
<br>
     
<input type="radio" name="cont" value="yes" checked=yes> Set Maintenance(suspends jobs)
<input type="radio" name="cont" value="no" checked=yes> Remove Maintenance
<input type="submit" value="continue"
</td>
<%
I tried :
if Request.Form ("cont") = "yes" then
SQLstr = "SQLStr1"
Else
SQLstr = "SQLStr2"
at the top, but i think that's fundamentally flawed, as the ASP has already run? So i'm after a way of refreshing/running the form, after a radio button is selected..
Hope that makes sense, hope i've not missed a FAQ/thread explaining exactly how to do this!
I've had a good look around, and can't see a solution to this (or quite possibly, there is a solution, just not one i understand!).
I'm a novice in ASP, so apologies in advance if this is a stupid question
I have a form calling another asp page, with a drop down box and two radio buttons. The drop down list is created via a SQL query, and the radio buttons are used on the following page.
What i'd like to do is change the SQL query, dependant on the radio button chosen. And this is where i have a mental blank.
The code I currently have is:
<form action = "setmaint.asp" method = post>
<%
**SQL CONNECTION BIT**
SQLstr = "SQL String goes here"
rs.open SQLstr, conn
If RS.EOF then
Response.write "<left>There are no records in the table"
Respose.write "<br>please check back later</left>"
Response.end
Else
%>
<p> <select size="1" name="ServerName">
<option>-Select One-</option>
<%
DO WHILE NOT RS.EOF
%>
<option value="<%Response.Write RS("Object_Name")%>"><%Response.Write RS("Object_Name")%></option>
<%
Rs.MoveNext
Loop
End If
%>
</select>
<br>
     
<input type="radio" name="cont" value="yes" checked=yes> Set Maintenance(suspends jobs)
<input type="radio" name="cont" value="no" checked=yes> Remove Maintenance
<input type="submit" value="continue"
</td>
<%
I tried :
if Request.Form ("cont") = "yes" then
SQLstr = "SQLStr1"
Else
SQLstr = "SQLStr2"
at the top, but i think that's fundamentally flawed, as the ASP has already run? So i'm after a way of refreshing/running the form, after a radio button is selected..
Hope that makes sense, hope i've not missed a FAQ/thread explaining exactly how to do this!