Announcement

Collapse
No announcement yet.

How do I pass a variable to an include?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How do I pass a variable to an include?

    I would like to pass a variable to an ASP page. I am using HSVoiceMail.asp, but would like to setup individual pages for each family member so they might view and listen to their own messages.
    In the code, this section:
    <pre class="ip-ubbcode-code-pre">
    .....
    intMailBoxCount = hsp.MBCount
    For i = 1 To intMailBoxCount
    hsp.MBSort
    Set intMailBox = hsp.MBGet(i)
    if intMailBox.username = ThisUser then
    .... etc
    </pre>
    I have "if intMailBox.username = ThisUser then"
    and can use it if I define the user: ThisUser = "Sheri", but I'd like to pass the name from another asp, as in:
    &lt;!-- #include file="HSVoiceMail.asp" --&gt;

    regards

    GenevaDude

    #2
    Add:

    ThisUser = Request.QueryString("ThisUser")
    'Set a default user if none passed
    If ThisUser = "" Then ThisUser = "DefaultUser"

    to HSVoiceMail.asp and then launch it with:

    HSVoiceMail.asp?ThisUser=Sheri

    as your link.


    Paul

    Comment


      #3
      The easiest way is to pass it on a querystring.
      Like, HSVoiceMail.asp?username=meme

      Here's an example:
      <pre class="ip-ubbcode-code-pre">
      -----------------------File1.asp----------------------
      &lt;HTML&gt;
      &lt;HEAD&gt;
      &lt;/HEAD&gt;
      &lt;BODY&gt;
      &lt;A HREF="File2.asp?language=ASP&type=general"&gt;Query sample&lt;/A&gt;
      &lt;/BODY&gt;
      &lt;/HTML&gt;

      -----------------------File2.asp----------------------
      &lt;%
      For Each item In Request.QueryString
      Response.Write(item & " = " & Request.QueryString(item) & VbCrLf)
      Next
      %&gt;
      </pre>

      -Rupp

      How come "abbreviated" is such a long word?
      -Rupp
      sigpic

      Comment


        #4
        I know that your response was not here when I started typing and I also know it didn't take me 4 minutes to type in my response. I wouldn't have answered knowing you had answered. Is this a problem on my machine or on this board? Anyway sorry for the double reply.

        -Rupp

        How come "abbreviated" is such a long word?
        -Rupp
        sigpic

        Comment


          #5
          Hey thanks to both of you. The trick I needed was in the "SelectVoiceMail.asp?ThisUser=Sheri" part. (I renamed the file for my edits so the original would be preserved.)

          What I did for each individual is:
          striptags = false
          port = 8080
          host = "http://192.168.x.x"
          page = "/SelectVoiceMail.asp?ThisUser=Sheri"
          WebPage = hs.GetURL(host, page, strip_tags, port)

          and then a bit further down:

          &lt;table border="0" cellpadding="4" cellspacing="2" align="center" width=100%&gt;
          &lt;%Response.Write WebPage%&gt;

          Probably a bit unconventional but it works. This way I get the phone messages in my kids web page with all the other stuff they want on it.

          regards,


          GenevaDude

          Comment

          Working...
          X