473,386 Members | 1,835 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

POST/SESSION variables and pagination

Unicron
Hi folks, I have been working on a property listing search for a company for a while now and have hit a roadblock. I have searched the net up and down. A lot of Google results lead to this site, but I have never been able to get it to work.

Here's the setup-

The user submits search criteria via POST. The results php page pulls the $_POST array and displays the results with pagination of 20 results per page with links for Next/Previous.

Clicking on the pagination links loses the variables, whether I simply used $_POST or whether I coded, for instance, $_SESSION['county'] = $_POST['county']; at the top of the script. I, of course, am using session_start(); at the top of the scripts. I have tried all manner of responses regarding sessions,globals,php.ini, and anything else.

The pagination links uses a query string that refers to PHP_SELF and looks like
"http://localhost/advancedsearch.php?offset=21"
where the offset is the 2nd page of 20 results.


Does anyone have any ideas?
Apr 16 '07 #1
3 6383
code green
1,726 Expert 1GB
Clicking on the pagination links loses the variables, whether I simply used $_POST or whether I coded, for instance, $_SESSION['county'] = $_POST['county']; at the top of the script
Using a hypelink does not generate the POST array .This is only generated from a form. You need to pass the variables as URL variables or as SESSION variables
Apr 17 '07 #2
Thanks for the response! I knew I had to use session variables, but it just wasn't working. Apparently I missed something, because I put this code in and now everything works great-

foreach($_POST as $k => $v)
{
$_SESSION[$k] = $v;
}

The strange thing is, I used this before and it didn't work. I must have mucked it up elsewhere. Thanks though! It works.
Apr 17 '07 #3
Nirav
1
session_start();

if (! isset session [query])
{build up query using your post variables;
assign / set a session[query];
}

rest of your code (db connection, pagination, echo results, bla bla)
Oct 22 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Robert | last post by:
I am using the php4-cgi Debian package which is based on PHP 4.3.4. I have problems when running php4 on the command line. If I say something like $ php4 index.cgi a number of variables...
3
by: StinkFinger | last post by:
Hello all, I am working on some simple pages that pass non-critical information (i.e. no passwords, usernames, etc.) to and from different pages. Currently, I am using FORMs w/the POST method. I...
15
by: Thomas Scheiderich | last post by:
I am trying to understand Session variables and ran into a question on how they work with data that is passed. I have an HTM file that calls an ASP file and sends the name either by GET or POST....
2
by: Asp Help | last post by:
I'm working on a ASP applicatition to create Windows 2000 users. Because I don't want everybody to have access to the site I've changed te security in IIS 5.0 which runs on a windows 2000 Sp4...
4
by: John Kandell | last post by:
Hi, I posted this in the asp.net group, but didn't get a response. Maybe someone here can help me with this... --- Would someone be able to shed some light on what is the cost of saving a...
2
by: Vishal | last post by:
Hello, I am posting some credit card info to the payment server via a similar code. My code is written in VB.NET but uses the same approach. At the end however I do a...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
10
by: EOZyo | last post by:
Hi, i'm trying to set pagination for a search i run on my website, i'll try to explain the easiest i can: When i click the search button on search.php, data is received and stored in variables...
3
by: Leo | last post by:
Can anyone help or offer some explanation with this problem: I'm trying to do a POST from one of my PHP pages, to another page on my site using curl. To maintain the session I'm sending the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.