#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Buffalo, NY
    Posts
    156
    Rep Power
    12

    Passing URL date variables


    I'm a PHP programmer, not ASP so this may be a very simple question:

    I am trying to pass two variables to an ASP page so I can display a coresponding crystal report. The variables are start_date and end_date. Here is the code:

    --== <index.html - Start> ==--

    <form method="get" action="display.asp">
    Date Range: From <input type="text" name="start_date" value="2/1/03"> To <input type="text" name="end_date" value="2/1/03"><br>
    <input type="submit" value="Display"> <input type="reset" value="Reset">
    </form>

    --== <index.html - end> ==--

    --== <display.asp - start> ==--
    Set StartDate = request.QUERY_STRING("start_date")
    Set EndDate = request.QUERY_STRING("end_date")
    Session("oRpt").ParameterFields.GetItemByName("Start_Date").AddCurrentValue(CDate("StartDate"))
    Session("oRpt").ParameterFields.GetItemByName("End_Date").AddCurrentValue(CDate("EndDate"))
    --== <display.asp - end> ==--

    I know so little about ASP that I can't even get it to display on the page to make sure the variables are being passed properly.

    Any help would be appreciated!
    Forget Milk!
    Gotspy?

    www.gotspy.com
  2. #2
  3. No Profile Picture
    Overly white
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    Fresno, CA
    Posts
    83
    Rep Power
    12
    --== <display.asp - start> ==--
    Set StartDate = request.QUERY_STRING("start_date")
    Set EndDate = request.QUERY_STRING("end_date")
    Session("oRpt").ParameterFields.GetItemByName("Start_Date").AddCurrentValue(CDate("StartDate"))
    Session("oRpt").ParameterFields.GetItemByName("End_Date").AddCurrentValue(CDate("EndDate"))
    --== <display.asp - end> ==--
    I think all you need to do is remove the sets. So you should just have this
    Code:
    --== <display.asp - start> ==--
    StartDate = request.QUERY_STRING("start_date")
    EndDate = request.QUERY_STRING("end_date")
    Session("oRpt").ParameterFields.GetItemByName("Start_Date").AddCurrentValue(CDate("StartDate"))
    Session("oRpt").ParameterFields.GetItemByName("End_Date").AddCurrentValue(CDate("EndDate"))
    --== <display.asp - end> ==--
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Buffalo, NY
    Posts
    156
    Rep Power
    12
    I removed the sets and got the same thing.

    I did notice however that the date that is getting passed in the URL is:

    display.asp?start_date=3%2F1%2F03&end_date=3%2F30%2F03

    I need it to get converted back to:

    display.asp?start_date=3/1/03&end_date=3/30/03

    How would I replace "%2F" with "/"?

    I guess this is asking two seperate questions?
    Forget Milk!
    Gotspy?

    www.gotspy.com
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Location
    Bavaria, Germany
    Posts
    140
    Rep Power
    12
    You don't need to decode those chars, if you access your parameters via Request.QueryString("start_date") those % thingies will be decoded and you get your original format.
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Buffalo, NY
    Posts
    156
    Rep Power
    12
    Well so much for that idea. Thanks for the info.

    This is to serve a Crystal Report, I'm going to give them a call in a little bit and see what they say. Thanks for the help.

    I will post the answer if I get one.
    Forget Milk!
    Gotspy?

    www.gotspy.com
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Buffalo, NY
    Posts
    156
    Rep Power
    12

    And the answer is...


    Set StartDate = request.QUERYSTRING("start_date")
    Set EndDate = request.QUERYSTRING("end_date")
    Session("oRpt").ParameterFields.GetItemByName("Start_Date").AddCurrentValue(CDate(StartDate))
    Session("oRpt").ParameterFields.GetItemByName("End_Date").AddCurrentValue(CDate(EndDate))

    Take the _ out of QUERY_STRING and remove the "" from the (CDATE("EndDate"))

    Thanks for the help.
    Forget Milk!
    Gotspy?

    www.gotspy.com
  12. #7
  13. No Profile Picture
    Overly white
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    Fresno, CA
    Posts
    83
    Rep Power
    12
    DOH
    HA I didn't even see the underscore their.

IMN logo majestic logo threadwatch logo seochat tools logo