6 Replies Latest reply on Oct 6, 2008 11:12 PM by Clive

    How to retain form values after a search

    Clive Level 1
      Hi
      I'm using ADDT and have a page with s search box that works Ok and my results query brings back the correct records based on the form values.

      The problem is they atretch over one page.
      When I click next (in the recordset navigation bar) the form values are lost and the search query does not work (i.e returns nothing)

      Cannot any help suggest a way to get this working?

      Thanks in advance
      Clve
        • 1. Re: How to retain form values after a search
          Günter Schenk Level 4
          Hi Clive,

          did you try to append the search string (most probably a $_POST['fieldname'] value) to the Recordet Navigation URL ? And BTW, are you passing this form value using the GET or POST method ?

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: How to retain form values after a search
            Clive Level 1
            Hi Günter , Many thanks for the response.

            I can use GET and the parameters are passed OK via the url but one of the parameters is a date and the slashes are converted to % signs.
            I tried using Post to get round this which works OK for the first page but then the POSTed values are not retained for subsequent pages.

            I suppose my real problem is trying to get a date e.g dd/mm/yy passed as a valid url parameter.

            Any advice much appreciated
            Thanks
            Clive
            • 3. Re: How to retain form values after a search
              Günter Schenk Level 4
              Clive,

              as you´re using ADDT, I think there´s a possible discrepancy between the date format (dd/mm/yy, is this your "screen format" ?) you´re trying to pass via URL parameter and the date format that´s usually stored in a MySQL database (yyyy-mm-dd).

              If possible, I´d suggest to rather use the native MySQL date format within your query string, because this one is pretty fool-proof when used in URL parameters -- and in case you´re using this date for querying a database, ADDT´s "screen format" won´t help you anyway as long as the dates are stored as yyyy-mm-dd

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: How to retain form values after a search
                Clive Level 1
                Hi, thanks again
                Yes, I'm using Date ADDT Date Picker in a search form and the screen format is dd/mm/yy (Don't ask me why the Brits have to be different!!)

                if I can get the date across, I can reformst it to query the MYSQL database
                If it's any help the the url showing all this is http://www.finelineuk.com/job_search.php

                Kind regards
                Clive
                • 5. Re: How to retain form values after a search
                  Günter Schenk Level 4
                  Hi Clive,

                  ok that´s fine, the page´s source code reveals that the form uses the GET method -- but I´d have to see the DW source code of "search_results_advanced.php" to get a clue what going on there, and when testing the form it would be helpful to know what "posted after" dates will return matching records.

                  As usual, please post the "search_results_advanced.php" code as .txt file on your server and post a link to this file.

                  However it´s now clear that you´ll indeed have to use the Datepicker´s dd/mm/yy - format. My best bet is to use PHP to pre-convert this date on "search_results_advanced.php" to a regular MySQL date, assign the converted value to a new PHP variable, and pass this variable in the recordset navigation´s query string

                  Cheers,
                  Günter Schenk
                  Adobe Community Expert, Dreamweaver
                  • 6. Re: How to retain form values after a search
                    Clive Level 1
                    Hi Günter
                    I did as you suggested and whwn I displayed the posted date value it displayed OK (i.e without the % signs)!!!
                    I'll now try and reformat from dd/mm/yy to yyyy-mm-dd for the query search.
                    Thank you very much for all you help

                    Very best wishes
                    Clive