4 Replies Latest reply on May 21, 2008 5:04 AM by Günter Schenk

    [php+mysql] how to pass data from one insert form to another?

      Hi all,

      I have an insert form (in a mysql db) on the page. Is there a way to
      view the inserted data after inserting so stat the user can print it
      out?

      TIA

      tony
        • 1. Re: [php+mysql] how to pass data from one insert form to another?
          Günter Schenk Level 4
          Hi Tony,

          let´s assume the table´s Primary Key column is named "id" -- just add this value (available as "Dynamic Data") to the "Redirect after Insert" URL in the following way:

          print.php?id={id}

          ...and on that page add a recordset which queries the table like that:

          "SELECT * FROM tablename WHERE id" equals the URL parameter "id"

          That should be all there is to do.

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: [php+mysql] how to pass data from one insert form to another?
            Level 1
            >Hi Tony,
            >let´s assume the table´s Primary Key column is named "id" -- just add this value (available as "Dynamic Data") to the "Redirect after Insert" URL in the following way:
            >print.php?id={id}
            >...and on that page add a recordset which queries the table like that:
            >"SELECT * FROM tablename WHERE id" equals the URL parameter "id"
            >That should be all there is to do.
            >Cheers,
            >Günter Schenk
            >Adobe Community Expert, Dreamweaver

            Hi Günter,

            Thanks, it works.
            I added a bit of code to set a session variable using this Parameter
            URL, so that I can manage the record ID along the whole user session.

            So, I ask you a little question: when it is best to delete or destroy
            session variables? after displaying the inserted records or just befor
            inserting the first one?

            Here is my little test workflow:

            1- destroy variable sessions (I think I will unset session variables
            one by one instead, to eliminate the risk to delete other sesssion
            variable (UserID...)
            2- insert the first record (redirect to the next page using the record
            ID1)
            3- set a session variable (S1) using the ID1 coming from previous page
            ($_GET)
            4- insert the second record (redirect to the next page using the
            record ID2)
            5- set a session variable (S2) using the ID2 coming from previous
            page ($_GET)
            6- insert the third record (redirect to the next page using the
            record ID3)
            7- set a session variable (S3) using the ID3 coming from previous page
            ($_GET)
            8- create a recordsets to filter the db by S1, S2 and S3.
            9- display the report

            it seems to work.

            do you think there is something to refine?

            Thanks again for your kindness.

            tony
            • 3. Re: [php+mysql] how to pass data from one insert form to another?
              Level 1
              Hi Günter,
              is there an alternative to URL parameter on the redirect link?

              I would like to hide the URL parameter so that it is not possible to
              manipulate it.

              Is there a way to integrate such parameter in a hidden field in the
              form?

              TIA

              tony
              • 4. Re: [php+mysql] how to pass data from one insert form to another?
                Günter Schenk Level 4
                Hi Tony,

                -----
                is there an alternative to URL parameter on the redirect link?
                -----

                regretfully no.

                -----
                I would like to hide the URL parameter so that it is not possible to
                manipulate it
                -----

                that´s exactly the reason why I´m running the administrative stuff of my sites backends in frames and not single pages -- when having the ADDT Lists and Forms loaded in the lower frame of e.g. a horizontal frameset, the URLs are not revealed in the browser´s address bar.

                Cheers,
                Günter Schenk
                Adobe Community Expert, Dreamweaver