Re: adding "Back to Search results" link

From: Date: Thu, 16 Aug 2007 18:36:26 +0000
Subject: Re: adding "Back to Search results" link
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-260935@lists.php.net to get a copy of this message
Thanks for the help, Kirk. The form 2 uses a _GET to call the information from Form 1. So you select the serach criteria on Form 1, Form 2 returns the criteria, Form 3 is the result of a selection made on Form 2. And for some reason I can't pass that Query String from Form 1 into Form 3. I am still having problems passing the string. But only because at the point a user reaches form 1 the Session is already active. Maybe I am just placing the $_SESSION['search_results_querystring'] = $_SERVER['QUERY_STRING']; in the wrong place. I assume this has to be placed before right after my include statements. I am still messing around with it. I have also been told that maybe passing the value as a part of the (already established) cookie may work as well. Both options seem to use the same logic. I'll keep you posted. ""Kirk Friggstad"" <kirk@daftviking.com> wrote in message news:ac238df10708151506q143b65ewa8e57bdb5792f27e@mail.gmail.com... > Derek: > > Does "form 1" use POST or GET to call "form 2"? If it uses GET, you > could store the search page URL in a $_SESSION variable - something > like this in your search results (form 2): > > $_SESSION['search_results_querystring'] = $_SERVER['QUERY_STRING']; > > and in your editing page (form 3): > > <a href="form2.php?<?php echo $_SESSION['search_results_URL'] > ?>">Back > to search results</a> > > (You'll need session support in both pages, of course - make sure you > call session_start() before working with the $_SESSION array). > > If "form 1" uses POST, then it'll get a little more complicated - you > could try saving the $_POST data in the session (think there was a > recent thread on this list regarding that) and creating a form with > hidden elements on "form 3" that does a POST back to "form 2". > > I'm a bit of a PHP newbie myself (just coming out of a long career in > ASP/VBscript development), so I'd appreciate any comments, (gentle) > criticism, etc. Hope this helps. > > Kirk > > On 8/15/07, Derek <dmoon3@depaul.edu> wrote: >> Jim and Brad. >> >> Thanks for the feedback. I was thinking it was something simple like a >> back >> button. But the problem that arises when I use this method is on Form 3. >> >> If I go through the steps, and make a change to an item on Form 3. Then >> use >> the <a href="javascript:history.go(-2);">Return to search >> results</a>.....everything works fine. >> But if I dont make any changes to Form 3. then this takes me all the way >> back to the search page. >> >> People in my group use this form to update database information for a >> number >> of items. Once they make changes, they would like to go back to the >> search >> results, instead of having to run the same search again and again. >> >> >> >> >> "Jim Lucas" <lists@cmsws.com> wrote in message >> news:46C361B8.8040604@cmsws.com... >> > Derek Moon wrote: >> >> I am trying to imporve a web application that my group uses. >> >> >> >> Basically there are 3 forms that work together Form 1 > form 2 >> >> >> >> Form 1 - searchs for enterend values >> >> Form 2 - returns search results, letting you individually select any >> >> item >> >> Form 3 - lets you edit a specific individual item >> >> >> >> I want to make a link on the Form 3 that returns you to form Form 2 >> >> basically a "Back to Search results" link. >> >> >> >> I'm thinking that there is a way to pass the query string, but I am a >> >> newbie and I'm not sure that I am going about this the right way. >> >> >> >> Anyone have any advice or knowledge to share?

« previous php.general (#260935) next »