$_SESSION=$_POST

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

    #1

    $_SESSION=$_POST

    if i set a $_SESSION=$_POS T in every page of a multiple page form how
    then would i call it on a later page of the same session? and also how
    is distigushed between pages ? should it be set up differently on each
    page, ive read of
    $_SESSION['variablename']=$_POST
    but i cant seem to figure out how to call it back at the end of the form

  • LB

    #2
    Re: $_SESSION=$_POS T

    Quinonez wrote:[color=blue]
    > if i set a $_SESSION=$_POS T in every page of a multiple page form how
    > then would i call it on a later page of the same session? and also how
    > is distigushed between pages ? should it be set up differently on each
    > page, ive read of
    > $_SESSION['variablename']=$_POST
    > but i cant seem to figure out how to call it back at the end of the form
    >[/color]
    it's called back using echo $_SESSION['variable']...that simple

    Comment

    • Quinonez

      #3
      Re: $_SESSION=$_POS T

      here is an example of my code:
      =======resource s_a6.php=====
      <?
      session_start() ;
      header("Cache-control: private");
      $_SESSION['resources_a6'] = $_POST;
      ?>
      <html>
      <head>
      <title>2004 APPLICATION FOR AFFILIATION</title>
      <meta http-equiv="Content-Type" content="text/html;
      charset=iso-8859-1">
      <link href="forms.css " rel="stylesheet " type="text/css">
      </head>
      <body bgcolor="#00000 0" leftmargin="0" topmargin="0">
      <form action="resourc es_a7.php" method="post">
      ............... ...
      // then my form and submit button are here so on and so on

      ======resources _a7.php======== ==
      <?
      session_start() ;
      header("Cache-control: private");
      $_SESSION['resources_a7'] = $_POST;
      ?>
      <html>
      <head>
      <title>2004 APPLICATION FOR AFFILIATION</title>
      <meta http-equiv="Content-Type" content="text/html;
      charset=iso-8859-1">
      <link href="forms.css " rel="stylesheet " type="text/css">
      </head>
      <body bgcolor="#00000 0" leftmargin="0" topmargin="0">
      <form action="testthi s.php" method="post">
      ............... ...
      // then my form and submit button are here so on and so on

      =============te stthis.php===== ===
      <?
      session_start() ;
      header("Cache-control: private");
      ?>
      <html>
      <body>

      <?
      foreach($_POST as $field=>$value)
      {
      echo "$field = $value<br>";
      }
      ?>


      </body>
      </html>

      How do i change this to display correctly? currently it will only
      display the last page

      Comment

      • LB

        #4
        Re: $_SESSION=$_POS T

        Quinonez wrote:[color=blue]
        > here is an example of my code:
        > =======resource s_a6.php=====
        > <?
        > session_start() ;
        > header("Cache-control: private");
        > $_SESSION['resources_a6'] = $_POST;
        > ?>
        > <html>
        > <head>
        > <title>2004 APPLICATION FOR AFFILIATION</title>
        > <meta http-equiv="Content-Type" content="text/html;
        > charset=iso-8859-1">
        > <link href="forms.css " rel="stylesheet " type="text/css">
        > </head>
        > <body bgcolor="#00000 0" leftmargin="0" topmargin="0">
        > <form action="resourc es_a7.php" method="post">
        > ............... ..
        > // then my form and submit button are here so on and so on
        >
        > ======resources _a7.php======== ==
        > <?
        > session_start() ;
        > header("Cache-control: private");
        > $_SESSION['resources_a7'] = $_POST;
        > ?>
        > <html>
        > <head>
        > <title>2004 APPLICATION FOR AFFILIATION</title>
        > <meta http-equiv="Content-Type" content="text/html;
        > charset=iso-8859-1">
        > <link href="forms.css " rel="stylesheet " type="text/css">
        > </head>
        > <body bgcolor="#00000 0" leftmargin="0" topmargin="0">
        > <form action="testthi s.php" method="post">
        > ............... ..
        > // then my form and submit button are here so on and so on
        >
        > =============te stthis.php===== ===
        > <?
        > session_start() ;
        > header("Cache-control: private");
        > ?>
        > <html>
        > <body>
        >
        > <?
        > foreach($_POST as $field=>$value)
        > {
        > echo "$field = $value<br>";
        > }
        > ?>
        >
        >
        > </body>
        > </html>
        >
        > How do i change this to display correctly? currently it will only
        > display the last page
        >[/color]
        ok, first make sure you have a variable in $_POST (ie $_POST['name'])
        then you can append values by using .= however it looks like your trying
        to set the session variable to an array and to be honest i'm not
        entirely sure how to had value to an array.. start at php.net with 'add
        values array' or similar...hope that helps

        Erick

        Comment

        • Quinonez

          #5
          Re: $_SESSION=$_POS T

          no actually that wasnt what i was looking for...i have looked through
          the groups and found that w. a mulitple page form all i had to do was
          set it as $_SESSION=$_POS T but after that i do not know what to do...

          Comment

          • Ken Robinson

            #6
            Re: $_SESSION=$_POS T


            Quinonez wrote:[color=blue]
            > here is an example of my code:[/color]

            [snip]
            [color=blue]
            >
            > =============te stthis.php===== ===
            > <?
            > session_start() ;
            > header("Cache-control: private");
            > ?>
            > <html>
            > <body>
            >
            > <?
            > foreach($_POST as $field=>$value)
            > {
            > echo "$field = $value<br>";
            > }
            > ?>
            >
            >
            > </body>
            > </html>
            >
            > How do i change this to display correctly? currently it will only
            > display the last page[/color]

            Here's one way...
            In each of your processing programs:
            <?
            $_SESSION['processed'][] = $_POST;
            ?>

            In testthis.php:
            <?
            for ($i=0;$i<count( $_SESSION['processed']);$i++)
            foreach ($_SESSION['processed'][$i] as $field => $key)
            echo "$field = $value<br>";
            ?>

            Note: this code is untested, so it may not work.

            Ken

            Comment

            • Pedro Graca

              #7
              Re: $_SESSION=$_POS T

              Quinonez wrote:
              <snip>[color=blue]
              >=============t estthis.php==== ====
              > <?
              > session_start() ;
              > header("Cache-control: private");[/color]

              $_SESSION['testthis'] = $_POST;
              [color=blue]
              > ?>
              > <html>
              > <body>
              >
              > <?
              > ## foreach($_POST as $field=>$value)
              > ## {
              > ## echo "$field = $value<br>";
              > ## }[/color]

              echo '<pre>'; print_r($_SESSI ON); echo '</pre>';

              or

              foreach ($_SESSION as $page=>$post) {
              echo "<h1>$page</h1>";
              foreach ($post as $field=>$value) {
              echo "$field = $value<br>";
              }
              }
              [color=blue]
              > ?>
              >
              >
              > </body>
              > </html>
              >
              > How do i change this to display correctly? currently it will only
              > display the last page[/color]

              The $_POST array only has the last submitted page.
              You need to use the $_SESSION array.


              Happy Coding :-)

              --
              Mail to my "From:" address is readable by all at http://www.dodgeit.com/
              == ** ## !! ------------------------------------------------ !! ## ** ==
              TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
              may bypass my spam filter. If it does, I may reply from another address!

              Comment

              • g18c@hotmail.com

                #8
                Re: $_SESSION=$_POS T

                May not be of interest (and indeed this may be wrong but it works for
                me) - Using PHP PEAR quickform

                if($form->validate())
                {
                $_SESSION = array_merge($_S ESSION,$form->exportValues() );
                }

                appends the form variables to the session. Then knowing the names of
                the fields i access them by $_SESSION['name']

                Chris

                Comment

                • Ken Robinson

                  #9
                  Re: $_SESSION=$_POS T


                  Quinonez wrote:[color=blue]
                  > no actually that wasnt what i was looking for...i have looked through
                  > the groups and found that w. a mulitple page form all i had to do was
                  > set it as $_SESSION=$_POS T but after that i do not know what to do...[/color]

                  If you don't know what to do, then first you have to see what you put
                  in the $_SESSION array. In each program, after you do the
                  $_SESSION=$_POS T, dump the contents of $_SESSION by doing

                  echo '<pre>';print_ r ($_SESSION); echo '</pre>';

                  After you see the contents, you should be able to figure out what to
                  do.

                  Ken

                  Comment

                  • Quinonez

                    #10
                    Re: $_SESSION=$_POS T

                    thanks all...i finally got it to work ..with answers here and there...

                    Comment

                    Working...