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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pass variables between frames

    I would like to be able to enter a date in my left frame and have the graph in the frame on the right reference that date. Being new to Javascript I'm not really sure where to start.

    In my left frame I have:
    <?
    if (isset($HTTP_GET_VARS["start"]))
    $Selectedstart = $HTTP_GET_VARS["start"];
    else
    $Selectedstart = get_first_datestamp();

    if (isset($HTTP_GET_VARS["end"]))
    $Selectedend = $HTTP_GET_VARS["end"];
    else
    $Selectedend = get_current_datestamp();
    $httpParam = "start=" . $Selectedstart . "&end=". $Selectedend;
    ?>

    <?
    function get_current_datestamp(){

    //get the current timestamp
    $currdate = gmdate("Ymd");
    $currday = substr($currdate,6,2);
    $currmonth = substr($currdate,4,2);
    $curryear = substr($currdate,0,4);
    $currdate_stamp = ($curryear . "-" . $currmonth . "-" . $currday);
    return $currdate_stamp;

    }//end of function get_current_datestamp;

    ?>

    <?
    function get_first_datestamp(){

    //get the current timestamp
    $currdate = gmdate("Ymd");
    $currday = substr($currdate,6,2);
    $currmonth = substr($currdate,4,2)-10;
    $curryear = substr($currdate,0,4)-1;
    $currdate_stamp = ($curryear . "-" . $currmonth . "-" . $currday);
    return $currdate_stamp;

    }//end of function get_first_datestamp;

    ?>

    <form action="<?php echo $HTTP_SERVER_VARS["SCRIPT_NAME"] ?>">
    Start Date: &nbsp;<input type="date" name="start" size="20" value="<?php echo $Selectedstart; ?>" />&nbsp;&nbsp;&nbsp;
    End Date: &nbsp;<input type="date" name="end" size="20" value="<?php echo $Selectedend; ?>" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="submit" value="OK">

    </form>

    In my right frame, instead of using:
    $Selectedstart = '2004-12-1';
    $Selectedend = '2005-1-1';

    I would like to receive the date from my left pane. Any help will be appreciated, thank you.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    If you want to retrieve the dates from the left frame to the right frame in the server-side, you just need to submit the left frame into the right frame

    <form name="frmDate" action="graph.php" target="nameOfRightFrame">

    Then in the right frame, you just do:

    $Selectedstart = $HTTP_GET_VARS["start"];

    And you don't need the php codes in the left frame as this page will not refresh because the page is not submitted to itself.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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