Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Passing variables through the URL inside frames

    I'm trying to pass a variable to my PHP script which is in a frame. I'm using <frame SRC="selectpage.php?page=14" NAME="bottom"> to do it. If I access the page through a normal URL, outside of frames, it gets the value of $page correctly, no problem. But inside of the frame, $page is undefined. How do I get this variable's value?

    Please help me, this is driving me crazy.

    Rich

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Using frames or not shouldn't effect anything to do with php.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Your problem is rather weird. What you did was correct. Post a short test case that shows the issue so we can have a detailed look at it.
    De gustibus non est disputandum.

  • #4
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK, now all the sudden my initial value of 14 is actually coming through. I'm not sure why it wasn't before. But when I click on a button to move to a different page, then things get broken and $page becomes a null value. Normally this code won't show the user the values of $page and $prevpage, i put them in for debugging purposes.

    Here's the code I've got:

    <?

    $prevpage=$page-1;
    echo
    "
    <html>
    <body bgcolor=\"#000000\">
    <font color=\"#ffffff\">
    page=$page
    prevpage=$prevpage
    </font>
    <form>
    <input type=\"image\" src=\"img/firstbutton.jpg\" height=\"48\" width=\"73\" border=\"0\" alt=\"go to first page\"
    onClick=\"parent.frames[0].location='page1.html';
    parent.frames[1].location='selectpage.php?page=1';\">
    ";
    if ($prevpage>0)
    {
    echo
    "
    <input type=\"image\" src=\"img/backbutton.jpg\" height=\"48\" width=\"73\" border=\"0\"
    alt=\"go to previous page\"
    onClick=\"parent.frames[0].location='page$prevpage.html';
    parent.frames[1].location='selectpage.php?page=$prevpage';\">
    ";
    }
    else
    {
    echo
    "
    <img src=\"img/backbutton.jpg\" height=\"48\" width=\"73\" border=\"0\" alt=\"you can't go back one page\">
    ";
    };
    echo
    "
    </form>
    </body>
    </html>
    ";

    ?>
    Last edited by ThatPHPGuy; 10-05-2003 at 01:12 AM.

  • #5
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Never mind. I was guilty of idiocy yesterday. A form was not the solution. All it needed was links, with the onClick handler in javascript added.

    D'OH!!!!!!!

    But I did get the problem fixed. That's the good news.


  •  

    Posting Permissions

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