Loading ...
Sorry, an error occurred while loading the content.

{Query} Architecture to save on each page on a train of pages in PHP

Expand Messages
  • axsubram
    Hi, We are building a series of pages for a client. For e.g. to user will enter a few details in the first page, select some photos in the 2nd, enter
    Message 1 of 6 , Oct 8, 2007
    • 0 Attachment
      Hi,

      We are building a series of pages for a client.
      For e.g. to user will enter a few details in the first page, select
      some photos in the 2nd, enter additional details in the 3rd and then
      preview and submit the complete information.

      When the user hits continue on each page, we want to save the
      information to mysql db.
      Currently what we are trying to do is to write the insert code/insert
      statements on the next page. For e.g once user hits continue on Page
      1, page 2 is executed and on Page 2 we try to save the details of
      Page 1.

      I feel this might not be the only way to save information in PHP. I
      would be more comfortable saving the Page 1 detiails in PAge 1 itself
      in order to handle errors/exceptions neatly. Anyone has any
      ideas/suggestions on how to do this ?

      Thanks

      Anand
    • Raja Shekar Reddy
      Hello, I have a doubt.........if user fills in the first page and continues to the second page, then if he find that his information in wrong in the first page
      Message 2 of 6 , Oct 8, 2007
      • 0 Attachment
        Hello,

        I have a doubt.........if user fills in the first page and continues to the second page, then if he find that his information in wrong in the first page and if he wants to edit the info of the first page, then what is the logic you are implementing in order to edit the information?

        I suggest you to use sessions instead of inserting the data directly into the database. save all the data in the sessions,then insert the whole data at a time into the database at the last (i.e.., final page).

        Thanks,
        Raja Shekar Reddy.

        On 10/8/07, axsubram <axsubram@...> wrote:

        Hi,

        We are building a series of pages for a client.
        For e.g. to user will enter a few details in the first page, select
        some photos in the 2nd, enter additional details in the 3rd and then
        preview and submit the complete information.

        When the user hits continue on each page, we want to save the
        information to mysql db.
        Currently what we are trying to do is to write the insert code/insert
        statements on the next page. For e.g once user hits continue on Page
        1, page 2 is executed and on Page 2 we try to save the details of
        Page 1.

        I feel this might not be the only way to save information in PHP. I
        would be more comfortable saving the Page 1 detiails in PAge 1 itself
        in order to handle errors/exceptions neatly. Anyone has any
        ideas/suggestions on how to do this ?

        Thanks

        Anand


      • beski
        hi, my opinion is storing the data page by page is better. if the four steps going to store data into a single table, then insert the first page data at the
        Message 3 of 6 , Oct 9, 2007
        • 0 Attachment
          hi,
          my opinion is storing the data page by page is better.
          if the four steps going to store data into a single table, then insert the first page data at the second step; for others just update the table, also have a field in table like flag to know the completed stage; - update the stage field step by step; keep a key at the session to find the record.
          If four steps store data in diff table - no prob keep a key in session and insert step by step.

          In storing all data in the session and insert at last case - we hav a problem - if the window closed in any step before save or system switched off coz of power failure we loss all data, then we hav to start from the first step.

          looking for others opinion.

          -Beschi.
          ----- Original Message ----
          From: Raja Shekar Reddy <m.rajashekarreddy@...>
          To: php4india@yahoogroups.com
          Sent: Tuesday, 9 October, 2007 11:46:17 AM
          Subject: Re: [php4india] {Query} Architecture to save on each page on a train of pages in PHP

          Hello,

          I have a doubt....... ...if user fills in the first page and continues to the second page, then if he find that his information in wrong in the first page and if he wants to edit the info of the first page, then what is the logic you are implementing in order to edit the information?

          I suggest you to use sessions instead of inserting the data directly into the database. save all the data in the sessions,then insert the whole data at a time into the database at the last (i.e.., final page).

          Thanks,
          Raja Shekar Reddy.

          On 10/8/07, axsubram <axsubram@yahoo. com> wrote:

          Hi,

          We are building a series of pages for a client.
          For e.g. to user will enter a few details in the first page, select
          some photos in the 2nd, enter additional details in the 3rd and then
          preview and submit the complete information.

          When the user hits continue on each page, we want to save the
          information to mysql db.
          Currently what we are trying to do is to write the insert code/insert
          statements on the next page. For e.g once user hits continue on Page
          1, page 2 is executed and on Page 2 we try to save the details of
          Page 1.

          I feel this might not be the only way to save information in PHP. I
          would be more comfortable saving the Page 1 detiails in PAge 1 itself
          in order to handle errors/exceptions neatly. Anyone has any
          ideas/suggestions on how to do this ?

          Thanks

          Anand





          Meet people who discuss and share your passions. Join them now.
        • D.S. JOSEPH
          Hi, Storing in Session can be useful in data correctness and completeness. However, when the person closes the browser before finally completing the process,
          Message 4 of 6 , Oct 9, 2007
          • 0 Attachment
            Hi,
             
            Storing in Session can be useful in data correctness and completeness.  However, when the person closes the browser before finally completing the process, the data is lost without commit in the database.
             
            I would suggest:  Ajax - for field by field posting into a temporary table, and finally, updating the main table on tab by tab basis (one form per tab) when all the mandatory fields for the form are entered.  However, this could cost heavy load on the server for every transaction.
             
            An alternative would be:
            1.  Have forms designed as tabs with next buttons connecting the flow between the forms.
            2.  For each form, when the next button is clicked, submit to one script page where $_POST is parsed for validation of fields.  Update the record and generate error messages stored in a Session variable.
            3.  Depending upon the fields that are not updated, redirect via header() to the respective tab with display of the error message from the session variable.  For example, when Tab1 is submitted, Submit1 will be set and thus, check for fields of Tab1.  If all fields are filled in, update the record and transfer control to Tab2.  Else, store list of invalid fields in $_SESSION['ErrorMsg'] and redirect back to Tab1.
            4.  On all tabs, if the session variable for ErrorMsg is not null, display it on top in red.
            5.  Follow this for all Tabs, so that at the end of the last tab, you have a success message displayed.
             
            Warm regards.
             
            Joseph
            0-9840413050


            ----- Original Message ----
            From: Raja Shekar Reddy <m.rajashekarreddy@...>
            To: php4india@yahoogroups.com
            Sent: Tuesday, October 9, 2007 11:46:17 AM
            Subject: Re: [php4india] {Query} Architecture to save on each page on a train of pages in PHP

            Hello,

            I have a doubt....... ..if user fills in the first page and continues to the second page, then if he find that his information in wrong in the first page and if he wants to edit the info of the first page, then what is the logic you are implementing in order to edit the information?

            I suggest you to use sessions instead of inserting the data directly into the database. save all the data in the sessions,then insert the whole data at a time into the database at the last (i.e.., final page).

            Thanks,
            Raja Shekar Reddy.

            On 10/8/07, axsubram <axsubram@yahoo. com> wrote:

            Hi,

            We are building a series of pages for a client.
            For e.g. to user will enter a few details in the first page, select
            some photos in the 2nd, enter additional details in the 3rd and then
            preview and submit the complete information.

            When the user hits continue on each page, we want to save the
            information to mysql db.
            Currently what we are trying to do is to write the insert code/insert
            statements on the next page. For e.g once user hits continue on Page
            1, page 2 is executed and on Page 2 we try to save the details of
            Page 1.

            I feel this might not be the only way to save information in PHP. I
            would be more comfortable saving the Page 1 detiails in PAge 1 itself
            in order to handle errors/exceptions neatly. Anyone has any
            ideas/suggestions on how to do this ?

            Thanks

            Anand





            Moody friends. Drama queens. Your life? Nope! - their life, your story.
            Play Sims Stories at Yahoo! Games.
          • Anand Subramanian
            Hi, Thanks a lot for the answers. As the pages are separate (and optional) by each other, we do store to the db at the end of each page. My concern is
            Message 5 of 6 , Oct 11, 2007
            • 0 Attachment
              Hi,
               
              Thanks a lot for the answers. As the pages are separate (and optional) by each other, we do store to the db at the end of each page.
              My concern is regarding where the code to store the page information resides - In Page 1 or PAge 2.
              For e.g. in Page 1 user enters values and hits continue button, This brings up page 2. Currently the code to store values from PAge 1 actually resides in PAge 2. Is this the best approach?
               
              Is there any approach by which I can have the code to store page 1 values in PAge 1 itself ?
               
              Thanks a lot
               
              Anand
               
              ----- Original Message ----
              From: beski <beschi_tcr@...>
              To: php4india@yahoogroups.com
              Sent: Tuesday, October 9, 2007 4:09:13 PM
              Subject: Re: [php4india] {Query} Architecture to save on each page on a train of pages in PHP

              hi,
              my opinion is storing the data page by page is better.
              if the four steps going to store data into a single table, then insert the first page data at the second step; for others just update the table, also have a field in table like flag to know the completed stage; - update the stage field step by step; keep a key at the session to find the record.
              If four steps store data in diff table - no prob keep a key in session and insert step by step.

              In storing all data in the session and insert at last case - we hav a problem - if the window closed in any step before save or system switched off coz of power failure we loss all data, then we hav to start from the first step.

              looking for others opinion.

              -Beschi.
              ----- Original Message ----
              From: Raja Shekar Reddy <m.rajashekarreddy@ gmail.com>
              To: php4india@yahoogrou ps.com
              Sent: Tuesday, 9 October, 2007 11:46:17 AM
              Subject: Re: [php4india] {Query} Architecture to save on each page on a train of pages in PHP

              Hello,

              I have a doubt....... ...if user fills in the first page and continues to the second page, then if he find that his information in wrong in the first page and if he wants to edit the info of the first page, then what is the logic you are implementing in order to edit the information?

              I suggest you to use sessions instead of inserting the data directly into the database. save all the data in the sessions,then insert the whole data at a time into the database at the last (i.e.., final page).

              Thanks,
              Raja Shekar Reddy.

              On 10/8/07, axsubram <axsubram@yahoo. com> wrote:

              Hi,

              We are building a series of pages for a client.
              For e.g. to user will enter a few details in the first page, select
              some photos in the 2nd, enter additional details in the 3rd and then
              preview and submit the complete information.

              When the user hits continue on each page, we want to save the
              information to mysql db.
              Currently what we are trying to do is to write the insert code/insert
              statements on the next page. For e.g once user hits continue on Page
              1, page 2 is executed and on Page 2 we try to save the details of
              Page 1.

              I feel this might not be the only way to save information in PHP. I
              would be more comfortable saving the Page 1 detiails in PAge 1 itself
              in order to handle errors/exceptions neatly. Anyone has any
              ideas/suggestions on how to do this ?

              Thanks

              Anand





              Meet people who discuss and share your passions. Join them now.



              Tonight's top picks. What will you watch tonight? Preview the hottest shows on Yahoo! TV.
            • D.S. JOSEPH
              (Show ErrorMsg if any) Page 1 (form 1) Submit to Sub1.php Sub1.php Is Data Complete? Store ErrorMsg. If yes, Add data from the submitted data and proceed to
              Message 6 of 6 , Oct 12, 2007
              • 0 Attachment

                (Show ErrorMsg if any)

                Page 1

                (form 1)

                Submit to Sub1.php

                Sub1.php
                Is Data Complete?
                Store ErrorMsg.

                If yes, Add data from the submitted data and proceed to page2.

                (Show ErrorMsg if any)

                Page 2

                (form 1)

                Submit to Sub2.php

                Sub2.php
                Is Data Complete?
                Store ErrorMsg.

                If yes, Add data from the submitted data and proceed to page3.

                Hi Anand,
                 
                It's very simple.
                 
                Page 1 will have the following flow:
                 
                1.    Check if form is submitted ($_FORM)
                    1.1  If yes, validate form variables.
                        1.1.1   If valid.
                            1. store data in the database.
                            2. redirect to page 2.
                        1.1.2 If not, store error message in variable.
                2.    If error message is set, display the error message.
                3.    Display the Form in Page 1.
                 
                Note that redirection won't work if the page has started to render.  Hence, take note that the redirection step happens before any echo statement in the script.
                 
                Follow this for all the forms.
                 
                Wish you success!!!
                 
                Joseph
                9840413050

                (Show ErrorMsg if any)

                Page 1

                (form 1)

                Submit to Sub1.php

                Sub1.php
                Is Data Complete?
                Store ErrorMsg.

                If yes, Add data from the submitted data and proceed to page2.

                (Show ErrorMsg if any)

                Page 2

                (form 1)

                Submit to Sub2.php

                Sub2.php
                Is Data Complete?
                Store ErrorMsg.

                If yes, Add data from the submitted data and proceed to page3.

                 
                 


                ----- Original Message ----
                From: Anand Subramanian <axsubram@...>
                To: php4india@yahoogroups.com
                Sent: Thursday, October 11, 2007 3:23:33 PM
                Subject: Re: [php4india] {Query} Architecture to save on each page on a train of pages in PHP

                Hi,
                 
                Thanks a lot for the answers. As the pages are separate (and optional) by each other, we do store to the db at the end of each page.
                My concern is regarding where the code to store the page information resides - In Page 1 or PAge 2.
                For e.g. in Page 1 user enters values and hits continue button, This brings up page 2. Currently the code to store values from PAge 1 actually resides in PAge 2. Is this the best approach?
                 
                Is there any approach by which I can have the code to store page 1 values in PAge 1 itself ?
                 
                Thanks a lot
                 
                Anand
                 
                ----- Original Message ----
                From: beski <beschi_tcr@yahoo. co.in>
                To: php4india@yahoogrou ps.com
                Sent: Tuesday, October 9, 2007 4:09:13 PM
                Subject: Re: [php4india] {Query} Architecture to save on each page on a train of pages in PHP

                hi,
                my opinion is storing the data page by page is better.
                if the four steps going to store data into a single table, then insert the first page data at the second step; for others just update the table, also have a field in table like flag to know the completed stage; - update the stage field step by step; keep a key at the session to find the record.
                If four steps store data in diff table - no prob keep a key in session and insert step by step.

                In storing all data in the session and insert at last case - we hav a problem - if the window closed in any step before save or system switched off coz of power failure we loss all data, then we hav to start from the first step.

                looking for others opinion.

                -Beschi.
                ----- Original Message ----
                From: Raja Shekar Reddy <m.rajashekarreddy@ gmail.com>
                To: php4india@yahoogrou ps.com
                Sent: Tuesday, 9 October, 2007 11:46:17 AM
                Subject: Re: [php4india] {Query} Architecture to save on each page on a train of pages in PHP

                Hello,

                I have a doubt....... ...if user fills in the first page and continues to the second page, then if he find that his information in wrong in the first page and if he wants to edit the info of the first page, then what is the logic you are implementing in order to edit the information?

                I suggest you to use sessions instead of inserting the data directly into the database. save all the data in the sessions,then insert the whole data at a time into the database at the last (i.e.., final page).

                Thanks,
                Raja Shekar Reddy.

                On 10/8/07, axsubram <axsubram@yahoo. com> wrote:

                Hi,

                We are building a series of pages for a client.
                For e.g. to user will enter a few details in the first page, select
                some photos in the 2nd, enter additional details in the 3rd and then
                preview and submit the complete information.

                When the user hits continue on each page, we want to save the
                information to mysql db.
                Currently what we are trying to do is to write the insert code/insert
                statements on the next page. For e.g once user hits continue on Page
                1, page 2 is executed and on Page 2 we try to save the details of
                Page 1.

                I feel this might not be the only way to save information in PHP. I
                would be more comfortable saving the Page 1 detiails in PAge 1 itself
                in order to handle errors/exceptions neatly. Anyone has any
                ideas/suggestions on how to do this ?

                Thanks

                Anand





                Meet people who discuss and share your passions. Join them now.



                Tonight's top picks. What will you watch tonight? Preview the hottest shows on Yahoo! TV.



                Building a website is a piece of cake.
                Yahoo! Small Business gives you all the tools to get online.
              Your message has been successfully submitted and would be delivered to recipients shortly.