Menu

carrying info from page to page

Help
2009-01-28
2013-06-03
  • seth meyerowitz

    seth meyerowitz - 2009-01-28

    hello,

    id like to know if there is anyway to carry information from one page to another.  if i wanted to collect someone's name and email on one page and have them click submit, and then take them to another page with some more fields but not force them to re enter that info.

    thanks

    seth

     
    • Dave H

      Dave H - 2009-01-28

      Hi Seth,
      the answer is PHPSESSION variables. embed php code at the top of each page like this. (both the html and php files)

      <?php
      session_start();
      foreach($_POST as $key=>$value){
      $_SESSION[$key]=$value;
      ?>

      then  from the next page, you can access the data. for instance, if on the first page you had a text box named Account, you could populate the Account text box on the second page like this:

      <font face="Verdana"><input type=text name='Account' size=20 value="<? echo $_SESSION['Account'] ?>"></td></tr>

      Once again, embedding php code into the html.

      See this man page:
      http://us3.php.net/session

      I just finished up a multiple page form were I did just that.

      Hope this helps.

      Dave

       
      • TNTEverett

        TNTEverett - 2009-01-30

        It is also possible to do this without sessions but it up to you to decide how you want or need it done. 
        Without sessions you would treat each new page as a processor for the previous page.  You can then carry previous page values by prepopulating new fields on a new version of the form or by populating hidden variables to be carried forward to the next page after clicking the next submit button. 

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.