www.webdeveloper.com
Results 1 to 4 of 4

Thread: Function to call at other page

  1. #1
    Join Date
    Jun 2011
    Posts
    20

    Post Function to call at other page

    <?php
    session_start();

    // For radio buttons to get the value from Form.
    if (isset($_POST['submit'], $_POST['type']))
    {
    $type = $_POST['type'];
    $_SESSION['a'][0] = (int)$type;
    if( !empty( $_SESSION['a'][0] ) )
    {
    $b = $_SESSION['a'][0];

    }


    }
    ?>

    it is the code that I use for getting the values from Radio buttons.
    But I want to use the Class . I want to use the Function in this class.
    so that value of Variable $b can be called at any page.
    I want to use $b for further calculations at other pages also.
    so what is its solution.
    i think, is its solution Classes and functions.
    If yes, then how can be code of this function and class.
    thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    Well, it's already in $_SESSION as $_SESSION['a'][0], so you could just use that; or save it as a separate session variable if you prefer, e.g. $_SESSION['b'].
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jun 2011
    Posts
    20

    Post

    Actually, I get the value

    $b = $_SESSION['a'][0];

    $c=$b*4;
    Now I use this $C valuefor further calcualtions and I use it for Graphs
    i e graph.php
    but this $c is not accessable at graph.php page.
    how can I access it.thanks.

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    Like I said, save it as a session variable in $_SESSION (and don't forget to do a session_start() on each page where you need to read/write to the $_SESSION array).
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles