July 14, 200818 yr I have a form. Users choose options from this form and the values are submitted to a PHP file. The PHP file takes the users values and performs a customized SQL Query. The results are split so that only 5 results show per page, with links at the bottom to "next" and "previous" results pages. I'm using $_server['php-self'] to re-submit the query when the user clicks "next" or "previous". But the users values from the original form, seem to be forgotten and the new query fails (to show page 2's results) because it no longer has user input. Still with me? (sorry for any bad explanation) How do I pass the users values again so that the PHP can keep performing the query? Thanks, Jarrad
July 14, 200818 yr You have 2 options: - store user preferences in a session variable(s); - pass the values along the url as parameters; (URL?param1=this¶m2=that¶m3=etc) Either way before you render the page you have to read those values and build the pagination links accordingly.
July 14, 200818 yr You have 2 options: - store user preferences in a session variable(s); - pass the values along the url as parameters; (URL?param1=this¶m2=that¶m3=etc) Either way before you render the page you have to read those values and build the pagination links accordingly. Thats what I was going to say...lucky I refreshed the tab before I posted.
July 16, 200818 yr Author Thanks for replies. I'm learning about session variables now, but I'm having a bit of trouble. Is there an alternative to include 'file.ext';? (not require) I have a parent php file that compiles an SQL Query based on user-input, and at the end of it I use include 'file.ext'; to link to the child php file that displays the querys results. The problem being, that the child php file that displays results, calls on itself. This, of course, re-runs the parent php file as well and empties all my variables that were originally set from a FORM POST... :/ I need to be able to execute the parent php file once only, and have the include''; child php file call on itself without re-running the parent code. Thanks for any replies, Jarrad
Create an account or sign in to comment