1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Passing full URL

Discussion in 'General Scripting Chat' started by ytmnd522, Jul 9, 2009.

  1. ytmnd522

    ytmnd522 Newbie

    Joined:
    Jul 9, 2009
    Messages:
    3
    Likes Received:
    0
    hello guys,

    I have a page with a form and url for example is
    http://www.site.com/index.php?id=1234567890
    (this form's action is pointing to "signup.php"

    lets say I want to submit this form using javascript on an iframe or frame how can I keep the ?id=1234567890 ?. is there a header I can send this in?
     
  2. drdankmendez

    drdankmendez Regular Member

    Joined:
    May 30, 2008
    Messages:
    218
    Likes Received:
    333
    Location:
    In front of my computer
    If i understand this correctly, you could do this many different ways. Here are a few...

    1) Using Sessions.
    You can start a session on your index page and put the id into the session using:

    Code:
    <?php
    session_start();
    $_SESSION['uId'] = $_GET['id'];
    ?>
    
    Just be sure to start the session on each page after that so you dont loose the session.

    2)Modify action of form.
    You can just pass the variable from the first page into the action of the form:
    Code:
    <form action="signup.php?id=<?=$_GET['id']?>"
    3)Pass as a form value.
    You can create a hidden form field on your index page and then pass the value into that field.
    Code:
    <input type="hidden" value="<?=$_GET['id']?>" name="hiddenId" />
    Hope this helps. Let me know if I am not understanding your request.
     
  3. ytmnd522

    ytmnd522 Newbie

    Joined:
    Jul 9, 2009
    Messages:
    3
    Likes Received:
    0
    thanks for the reply.

    the problem is that I want to keep the referer the same as http://www.site.com/index.php?1234567 when it hits signup.php. so when I do a $_SERVER['HTTP_REFERER'] on index.php it will show http://www.site.com/index.php?1234567