www.webdeveloper.com
Results 1 to 3 of 3

Thread: passing params to a page that uses post instead of get.

  1. #1
    Join Date
    Sep 2008
    Posts
    104

    passing params to a page that uses post instead of get.

    lets say I wanted to link to a page like this:

    <a href="oneofmypages.asp" title="Recent sites visited" target="_blank" >PageTrack</a>

    and wanted to pass a few parameters to oneofmypages.asp. Though, oneofmypages.asp uses post instead of get... so all of the logic on that page uses "request.form(vars)" (asp's version of getting params from post) instead of "request.querystring(vars)" (asp's get version of getting params from get).

    I would normally do:

    <a href="oneofmypages.asp?var1=asdf&var2=asdf&var3=asdf" title="Recent sites visited" target="_blank" >PageTrack</a>

    but since I'm using request.form(vars) on oneofmypages.asp, the paramets don't get picked up. Is there a way to pass these vars so that oneofmypages.asp can use the params w/o also doing a request.querystring(vars)?

    Thanks

  2. #2
    Join Date
    Sep 2008
    Posts
    408
    You'll have to use a form in one way or another.

    The form could be hidden and submitted via JavaScript.

    HTML Code:
    <form action="oneofmypages.asp" id="form_name" method="post">
    <input name="var1" type="hidden" value="asdf" />
    <input name="var2" type="hidden" value="asdf" />
    <input name="var3" type="hidden" value="asdf" />
    <a href="oneofmypages.asp?var1=asdf&var2=asdf&var3=asdf&" onclick="document.getElementById('form_name')submit();return false;">Page Track</a>
    </form>
    Note, the document.getElementById('form_name')submit();return false; submits the form and then returns false (to stop the link from working). However, if the end user doesn't have JavaScript installed it passes the variables as querystring.
    Mullanaphy!
    http://www.mullanaphy.com/

    Unless code is provided or an exact example is requested I think I'm going to start using psuedo code from now on...

    Also, I freelance as well. Inquire within!

  3. #3
    Join Date
    Sep 2008
    Posts
    104
    thanks, I guess that's what I'll have to do then

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles