#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Posts
    5
    Rep Power
    0

    Passing variable to javascript sourced php3


    I'm using this line in my pages (on freehosts, so no php or includes allowed) -

    <script language="JScript" src="http://www.mydomain.com/function.php3"></script>


    I need to pass the php the page referrer information. I used javascript to find the referrer and have given it the variable "ref" . How can I pass on ref to the php in this format -

    <script language="JScript" src="http://www.mydomain.com/function.php3?referrer=ref"></script>

    - where ref should be replaced by the variable ref.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    Brisbane, Australia
    Posts
    32
    Rep Power
    13
    This is a javascript question, but I will give you an answer anyway, since I'm such a nice guy

    Basically, somewhere else in your page (where you make ref equal to the referrer) you would document.write the tag you have.

    Example,

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    ref = (page referrer);
    document.write("<script language=\"JavaScript\" src=\"http://www.mydomain.com/function.php3?referrer=" + ref + "\"></script>");
    //-->
    </SCRIPT>
    Hope this helped.

    Regards,
    Robbo
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Posts
    5
    Rep Power
    0
    This didnt work for me, maybe because thejavascript that I get back has another document.write function in it?

IMN logo majestic logo threadwatch logo seochat tools logo