• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

creating a variable from a request.Querystring

The below is some code I have created- it swaps Grade to Math_bonus and displays the correct Math_bonus value for the entered Grade. I now want to expand on this and take points_awarded the outcome of the above, and check is it greater then values in multiple fields of multiple tables. I like to make points_awarded a variable for easy access, without messing up the code

<form action="test2.asp" method="get"><%
Set Con = Server.CreateObject("ADODB.Connection")
Con.Open "db2"

Set objRS = Server.CreateObject("ADODB.Recordset")
 

SQL = "Select Grade, Math_bonus From point_grade"
Set objRS = Con.Execute(SQL)

If Not objRS.EOF Then
 objRS.MoveFirst
 %>
 
                     <p>
                      <select name="Points_awarded" onchange="form.submit()">
                        <option></option>
                        <%
          Do While Not objRS.EOF
          %>
                        <option value="<%=objRS.Fields("Math_bonus")%>"><%=objRS.Fields("Grade") %></option>
                        <%
          objRS.MoveNext
          Loop
          %>
                      </select>
                      <%= request.Querystring("Points_awarded")%> </p>
                    <p>&nbsp; </p>
                  </form>
               
<%
          End If    
          %>
0
tmd200
Asked:
tmd200
1 Solution
 
memerotCommented:
At the beginning of your page just put
<%
Dim intPoints
intPoints = Request.QueryString("Points_awarded")
%>

It doesn't have to go at the top, but it's more useful there in case you find you need the variable at other places throughout your page.  But if you only access the value once, it's not really worth putting in a variable.  If you access it twice or more, then it's recommended.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now