erichpowell Posted November 8, 2008 Share Posted November 8, 2008 I am getting a bit confused here. So I have a web page (php) with some form fields which are submitted using POST. The values in these fields are used as parameters in a MySQL query and the resulting records are returned in a table below the form fields. So far so good. The confusion arose when I tried to add 'paging' capabilities to the web page. The URLs for 'next' & 'previous' specify parameters regarding which page of records to show: http://127.0.0.1/newbiz/TMPmdms6a0qix.php?pageNum_Presidents=1&totalRows_Presidents=12 . However, this url does not contain the parameters for the query and thus, my query gets lost - kind of an important detail when you're trying to get more records from the same query. The question, then, is if I have to convert my form fields to GET so that they appear in the URL too. Or whether there is some way to implement 'paging' with POST. (Or whether POST & GET can be integrated). I should mention that I originally gravitated towards POST because I read that it was more secure and am a bit reluctant to change my form fields to GET. Perhaps that is unwarranted. Link to comment https://forums.phpfreaks.com/topic/131923-solved-preserve-post-query-while-paging-records-with-get/ Share on other sites More sharing options...
zq29 Posted November 8, 2008 Share Posted November 8, 2008 You could store the POST submissions in a session variable... Link to comment https://forums.phpfreaks.com/topic/131923-solved-preserve-post-query-while-paging-records-with-get/#findComment-685361 Share on other sites More sharing options...
Yesideez Posted November 8, 2008 Share Posted November 8, 2008 One thing I found out by accident was declaring my FORM like this: <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> Whatever link you navigate from is recreated inside the FORM declaration with all the $_GET parameters meaning reading using $_POST is possible to read the data from the submitted form and $_GET can also be used to read the URL. I was also having the same problem in that FORM data was missing from the URL. Link to comment https://forums.phpfreaks.com/topic/131923-solved-preserve-post-query-while-paging-records-with-get/#findComment-685372 Share on other sites More sharing options...
erichpowell Posted November 8, 2008 Author Share Posted November 8, 2008 Thanks. I didn't know about session variables. I think that might be just what I'm looking for. Link to comment https://forums.phpfreaks.com/topic/131923-solved-preserve-post-query-while-paging-records-with-get/#findComment-685645 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.