Re: A link that goes nowhere!

From: Date: Wed, 21 May 2003 12:12:31 +0000
Subject: Re: A link that goes nowhere!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148402@lists.php.net to get a copy of this message
works unless JavaScript is turned off. I've always just passed in a variable in the form or in the url: myserver.mypage.php?prevURL=/whereIwasBefore.php Then mypage.php looks to see if it has been passed in. If it has make sure it's a valid option. (Check to make sure someone is not redirecting off-site. If that's important to you.) Code: $_REQUEST['prevURL'] = ((!isset($_REQUEST['prevURL']) or strlen(trim($_REQUEST['prevURL']))<=0) ? "/somePage.php" : urldecode($_REQUEST['prevURL'])); Then I execute the code on mypage.php and the last 2 lines are: header("location: {$_REQUEST['prevURL'] }"); exit(); =C= * Cal Evans * http://www.christianperformer.com * Stay plugged into your audience * The measure of a programmer is not the number of lines of code he writes but the number of lines he does not have to write. * ----- Original Message ----- From: <Larry_Li@amat.com> To: "Shaun" <shaun@mania.plus.com> Cc: <php-general@lists.php.net> Sent: Wednesday, May 21, 2003 5:18 AM Subject: Re: [PHP] A link that goes nowhere! > > try <a href="javascript:history.go(-1)">back</a> > > > --------------------------------------------------------------- -------------------------------------------------------- > > To: php-general@lists.php.net > cc: > "Shaun" <shaun@mania.plus.com> Subject: Re: [PHP] A link that goes nowhere! > 05/21/03 06:09 PM > > > > > > > > Thanks for your reply, > > but how could i add that to my link <a href="... > > Thanks > > "Adrian" <adrian@planetcoding.net> wrote in message > news:852337721.20030521115933@planetcoding.net... > > hi > > > > header('Location: > > '.($_SERVER['HTTP_REFERER']?$_SERVER['HTTP_REFERER']:'url to > > your > > startpage')); > > > > the "url to your startpage" is for users who block the referer. > > > > ------------------------ > > > Hi, > > > > > how can I add a link to a page that runs a script then goes back to the > page > > > i was on? > > > > > > > > > > ------------------------ > > -- > > Adrian > > mailto:adrian@planetcoding.net > > www: http://www.planetcoding.net > > www: http://webskyline.planetcoding.net > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#148402) next »