c_shelswell Posted May 16, 2009 Share Posted May 16, 2009 Hi, I've got a form on a page which searches and displays a load of records. A user can then view a record which navigates them away from that page. Is there a way to keep the post data from the previous page so i can add a back button? I thought of storing it all in session vars but this sounds like it could be a bit of a pain in the ar$e. Does anyone know of any better ideas? Cheers Link to comment https://forums.phpfreaks.com/topic/158374-solved-keeping-post-data-from-searches/ Share on other sites More sharing options...
papaface Posted May 16, 2009 Share Posted May 16, 2009 Use $_GET instead of $_POST unless there's sensitive information. Link to comment https://forums.phpfreaks.com/topic/158374-solved-keeping-post-data-from-searches/#findComment-835218 Share on other sites More sharing options...
c_shelswell Posted May 16, 2009 Author Share Posted May 16, 2009 that's a good idea. Never thought of that. Cheers Link to comment https://forums.phpfreaks.com/topic/158374-solved-keeping-post-data-from-searches/#findComment-835219 Share on other sites More sharing options...
c_shelswell Posted May 16, 2009 Author Share Posted May 16, 2009 Ok another question. If i change the form to $_GET is there an easy way to add that data back to a link like a back button? as the below isn't going to work. <?php <a href='<?php echo $_SERVER['PHP_SELF']; ?>?data=<?php print_r ($_GET); ?>'>Back</a> ?> Link to comment https://forums.phpfreaks.com/topic/158374-solved-keeping-post-data-from-searches/#findComment-835229 Share on other sites More sharing options...
c_shelswell Posted May 16, 2009 Author Share Posted May 16, 2009 sorry stupid question. Just do this: foreach ($_GET as $k => $v) { $link .= "&".$k."=".$v; } Link to comment https://forums.phpfreaks.com/topic/158374-solved-keeping-post-data-from-searches/#findComment-835231 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.