p
On a part of my site a user can select something and be sent to a page with yes or no options
if they choose yes it's fine, the scripts do as required then go where it needs to be
if they select no, there is nothing to do so I simply want them to go back to where they came from
$_SERVER['HTTP_REFERER']
this only gets the url up to the '.php?' but if the user is on page 2 then the url has a p=2
so:
pagename.php?p=2
if they are on page 1 it is pagename.php?
So how do I get the FULL URL?
I played with forms
basically getting that data from the url before they went to the next page
$_GET['p']
so it was in the url on the yes and no page too
then on the page with yes and no I got the value of p and assigned it to a VAR
$pagenumber = $_GET['p'];
and had the URL details before the p= by doing:
$url = $_SERVER['HTTP_REFERER'];
so say $pagenumber = 2
and $url = /folder/index.php
I cant for the life of me find or figure out how to put those two values together in a variable or whatever so I have the action for the NO form
any solutions to this? or any other approaches?
kazimmerman posted this at 23:37 — 30th July 2007.
He has: 698 posts
Joined: Jul 2005
You want to display the URL with the variables attached, as it would appear if one wanted to visit it?
So it seems you could do something like this, with the variables you have listed below:
$fullURL = $url . "?p=" . $pagenumber;
echo $fullURL;
and you could place that URL within just about anything to get the result of (in your example):
Kurtis
demonhale posted this at 05:18 — 31st July 2007.
He has: 3,278 posts
Joined: May 2005
Why dont you just put a basic link for the no part so that it goes to the desired page, rather than scripting it in?
i.e.
Yes (You follow form submite)
No (No)
or I might be misunderstanding what you're trying to achieve...
greg posted this at 18:30 — 31st July 2007.
He has: 1,581 posts
Joined: Nov 2005
hmm
Reading your post mscreashuns prompted me to try something I should have done myself really, - echoing the variable.
it revealed my true problem as it showed that $_SERVER['HTTP_REFERER'] does actually get the p=2 bit as well
Soits something within the page script when it goes to the next page, as it most certainly doesnt use the p=2 that is put in the address bar
demonhale, thanks but yes, you were on the wrong track
I have a page that has user items on it, if the user has more than 30 items it displays a link for page 2.but page 2 is still scripted within the same file, it has all the same layout etc, but just displays the 30-60 items
so if the user went to the delete item page and then changed his mind and selected NO, I wanted to send them back to whatever item page number they were viewing when they clicked to go to the next page
but basically sending the user to website.com/index.php?p=2 wont work because the scripts on the page havent determined there is a page 2 (p=2) until the page actually runs, so simply sending a user to that URL link doesnt cut it
I will have to have a good think about it
Thanks for the input though
I must remember to echo vars I am having trouble with the find out what they are doing
cheers!
demonhale posted this at 04:29 — 1st August 2007.
He has: 3,278 posts
Joined: May 2005
Well I was thinking along the lines of using a cookie instead... But now I get what you mean, I hope you resolve it...
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.