Trying to refresh page
Posted by Chris_Isaac (Chris Isaac), 22 August 2003Hi
I want to be able to refresh a page, what basically happens is the user gets the 1st say 5 results, then if they hit refresh they get another 5 which are randomly chosen.
I wanted to append a link to the bottom of the page to allow them to refresh using the script, the problem is the county field, although coming up in the url window is not coming up in the link, can anyone see why? I'm printing the varibles $town and $county at the end just to prove they contain the correct information (and they do).
Any ideas? or is there a simpler way to refresh the current page?
Posted by John_Moylan (jfp), 22 August 2003Hello.
Getting your script to call itself does seem the simplest way (to me) of doing this, and using $PHP_SELF is the best/ most portable way.
I can't see why this is not working though, I tried you example on the command line.
and the output was
Which is what I assume you want it to print.
One thing I'm in the habit of doing when getting pages to call themselves is trying to control the cache, basically trying to stop the browser keeping a copy of the page.
I do this with a file that I "include(filename)" which contains the below stuff:
They're pointers but not a real answer to why its not working I'm afraid.
Posted by Chris_Isaac (Chris Isaac), 22 August 2003Thanks for your response jfp, if I use PHP_SELF by itself, it just takes me back to the original search page, which is not what I want. Your example is what I'm after, but for some reason the $county field in the next bit of code isn't being picked up:
but I know $county has the correct value because I print it out to prove it! doesn't make sense why?
I get the following link option:
The county field just isn't there!
I'll bang my head against the wall a few more time to see if the answer comes to me, but any other thoughts gratefully received!
Posted by Chris_Isaac (Chris Isaac), 22 August 2003Well banging my head seemed to have worked. Now got it I substituted the line for :
and thats done the trick, but thank you anyway.
Posted by admin (Graham Ellis), 23 August 2003Chris, I'm guessing that your $county variable has a character that needs URL encoding in it (it probably starts with a space), and as you weren't encoding it in the first example, that space got through and was interpretted as a delimiter at the end of the HTTP request. Going gack to the lower level query string fixed the problem by sending out the encoded string that you read in. Neat solution
P.S. This one had me baffled when I first saw the post last night - I thought you might have forgotten to echo back a field in the URL or something, but I didn't have a chance to investigate / answer. I came here this morning thinking that I was going to have to give it some serious thought ... delighted that it's fixed, and the fix looks llike it should be a robust fix too.
Posted by Chris_Isaac (Chris Isaac), 23 August 2003Your guess is right, there is a space there!
seems to have solved the problem, the page is doing what it should now.
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho