Passing data through multiple web pages

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ben

    #1

    Passing data through multiple web pages

    Hi guyz,
    I am developing a website using php.This website involves
    dealing with forms which span over multiple pages.

    I want data obtained from 1 form to be available after 3-4 pages.

    This can be ofcourse achieved through use of cookies.But i am keeping
    cookies as last option as they r not supposed to be reliable.I want to
    achieve the above task using SESSION VARIABLES.Can someone please guide
    me how to use session variables?(and pass form data across several
    pages using them?)

    Thanking in advance,
    bye,
    ben

  • Erwin Moller

    #2
    Re: Passing data through multiple web pages

    ben wrote:
    [color=blue]
    > Hi guyz,
    > I am developing a website using php.This website involves
    > dealing with forms which span over multiple pages.
    >
    > I want data obtained from 1 form to be available after 3-4 pages.
    >
    > This can be ofcourse achieved through use of cookies.But i am keeping
    > cookies as last option as they r not supposed to be reliable.I want to
    > achieve the above task using SESSION VARIABLES.Can someone please guide
    > me how to use session variables?(and pass form data across several
    > pages using them?)
    >
    > Thanking in advance,
    > bye,
    > ben[/color]

    Hi,

    Try php.net for starters:


    Generally speaking:
    1) Make sure session work on your machine.
    (eg: where are session stored? CHeck also php.ini for session.autosta rt to
    make your life easier. If you have no write-access to php.ini, use
    session_start() above every page)
    2) on page1.php: put something in a session
    eg
    $_SESSION["firstname"] = $_POST["firstname"];

    3) On page23.php, retrieve it:
    echo $_SESSION["firstname"];

    Good luck and be sure you read the manual at php.net. It is good and
    explains a lot more than I possibly could over here.

    Regards,
    Erwin Moller

    Comment

    • Chung Leong

      #3
      Re: Passing data through multiple web pages

      That's what hidden fields are for. Session variables aren't very good
      solution here, as the user would get strange behavior if multiple
      windows are opened, or if the back button is used.

      Comment

      • Erwin Moller

        #4
        Re: Passing data through multiple web pages

        Chung Leong wrote:
        [color=blue]
        > That's what hidden fields are for. Session variables aren't very good
        > solution here, as the user would get strange behavior if multiple
        > windows are opened, or if the back button is used.[/color]

        THAT depends on the quality of the underlying code Chung. :-)
        But of course: Passing them all through hiddwen fields is another
        possibility. I use it quite often actually. :-)

        Regards,
        Erwin Moller

        Comment

        Working...