SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2006
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Asp to write value to a hidden field

    Was curious if someone could help me out. I'm setting up a website and using
    Server side includes to make it easier for maintaining.

    I've got a contact form that will be included on several pages and I need to know from what page the forms is getting posted from. If I can figure out how to pass one value to a hidden field I can use the form as an include instead of hard coding the whole form into each page.

    Ideally the value to be passed could be coded into each page then asp could pick it up and insert it into the hidden field.

    Any one point me in the right direction for accomplishing this. I don't have a clue about asp other than the basic include statement.

    Thanks
    Travis

  2. #2
    SitePoint Evangelist
    Join Date
    Dec 2004
    Posts
    419
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could use the Request.ServerVariables Object

    To get the name of the actual script you're looking at:

    Code:
    sScript = Request.ServerVariables("SCRIPT_NAME")
    To get the name of the referring page:

    Code:
    ref = request.servervariables("HTTP_REFERER")
    And finally, this is quite useful, to get an idea of all of the different ways the Request.ServerVariables Object can be used:

    http://www.4guysfromrolla.com/webtech/092298-3.shtml

    As taken from the above site:

    Code:
    Here is some code to iterate through all of the ServerVariable properties:
    
    <TABLE>
          <TR>
               <TD>
                    <B>Server Varriable</B>
               </TD>
               <TD>
                    <B>Value</B>
               </TD>
          </TR>
    
          <% For Each name In Request.ServerVariables %>
          <TR>
               <TD>
                    <%= name %>
               </TD>
               <TD>
                    <%= Request.ServerVariables(name) %>
               </TD>
          </TR>
          <% Next %>
    </TABLE>

  3. #3
    SitePoint Member
    Join Date
    Nov 2006
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks I'll check it out

    Travis


Bookmarks

Posting Permissions

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