Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts

    nooblah question

    how do i make it so that asp skips a certain code at the top of the page and then runs it when i click submit on a form, eg. have an insert record script, but only run the script after i push submit,
    im thinking about
    Code:
    if request.querystring("code") = 1 then
    "code goes here"
    respsone.redirect("page.asp")
    is this how its done?
    thanks in advance

    -baleric

  • #2
    Registered User
    Join Date
    Jan 2006
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You put it in a sub.

    Sub DifferentPage ()
    if request.querystring("code") = 1 then
    "code goes here"
    respsone.redirect("page.asp")
    End Sub


    Now...to call that code simply call the sub.

    Call DifferentPage()

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can do it as you posted

    Code:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <%
    If Request.Form("Submit") = "Submit" Then
    	Response.Write "you clicked Submit"
    End If
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    </head>
    
    <body>
    <form name="form1" method="post" action="">
      <input type="submit" name="Submit" value="Submit">
    </form>
    </body>
    </html>

    Do you want it with Request.Form or Request.QueryString?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •