$_GET information that includes "&" and "=" [solved]
Moderator: General Moderators
-
the9ulaire
- Forum Commoner
- Posts: 74
- Joined: Mon Jun 11, 2007 11:31 am
$_GET information that includes "&" and "=" [solved]
I want to put the information of a url in a link. I have successfully done so. But, I want to be able to retrieve all of the information. I have put the information in the url as: back=/mypage.php?p=1&a=34&s=a
How do I retrieve that entire value? It only retrieves /mypage.php?p=1 and leaves off the rest of the information.
Am I making sense?
My problem is to make a "Back" link with information from the URL.
Thanks guys!!
LWR
How do I retrieve that entire value? It only retrieves /mypage.php?p=1 and leaves off the rest of the information.
Am I making sense?
My problem is to make a "Back" link with information from the URL.
Thanks guys!!
LWR
Last edited by the9ulaire on Fri Feb 29, 2008 2:57 pm, edited 1 time in total.
- hawkenterprises
- Forum Commoner
- Posts: 54
- Joined: Thu Feb 28, 2008 9:56 pm
- Location: gresham,oregon
- Contact:
Re: $_GET information that includes "&" and "="
What I would suggest is using urlencode on your data, that will change the & and = to something useful. You can then just use urldecode and wala. Another way you might be able to get access directly is using $_SERVER['QUERY_STRING'];
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: $_GET information that includes "&" and "="
not sure exactly what you're looking for.... but take a look at http://php.net/http-build-query - it may be on the right track (or at least in the ballpark)
alternatively, you could explain exactly what you're actually trying to accomplish, end result wise.
alternatively, you could explain exactly what you're actually trying to accomplish, end result wise.
-
the9ulaire
- Forum Commoner
- Posts: 74
- Joined: Mon Jun 11, 2007 11:31 am
Re: $_GET information that includes "&" and "="
Yes, yes, my apologies. I should have done that in the first place.Kieran Huggins wrote:alternatively, you could explain exactly what you're actually trying to accomplish, end result wise.
Okay, so on "page1.php?s=1&pn=52", you can click a link to view more detailed information on "page2.php?s=1&a=46". The link you click on on page1.php retrieves the url and enters it into the link href. The final link looks like:
Code: Select all
<a href="page2.php?s=1&a=46&back=/page1.php?s=1&pn=52">View Details</a>Code: Select all
<a href="/page1.php?s=1&pn=52">Back</a>Does that better explain what I'm trying to do?
I have my first link built. It's a matter of building the "Back" link that's my problem.
Re: $_GET information that includes "&" and "="
if you are sending them back to the exact same page they came from why not try
Code: Select all
echo ' <a href="'.$_SERVER['HTTP_REFERER'].'">Back</a>;
-
the9ulaire
- Forum Commoner
- Posts: 74
- Joined: Mon Jun 11, 2007 11:31 am
Re: $_GET information that includes "&" and "="
I need to store that URL somehow. Because, they users can comment on the page. Which after commenting, the $_SERVER['HTTP_REFERER'] will be the page2.php they were just on, instead of going back to page1.php. Make sense? They can do stuff on page2.php, and I want the back link to be to the page that got them to page2.php from page1.php. But page1.php can have lots of different add ons to the URL.kryles wrote:if you are sending them back to the exact same page they came from why not try
Code: Select all
echo ' <a href="'.$_SERVER['HTTP_REFERER'].'">Back</a>;
-
the9ulaire
- Forum Commoner
- Posts: 74
- Joined: Mon Jun 11, 2007 11:31 am
Re: $_GET information that includes "&" and "="
I actually ended up being able to do it through this. I finally figured out a way to make it work. And it works perfectly!hawkenterprises wrote:What I would suggest is using urlencode on your data, that will change the & and = to something useful. You can then just use urldecode and wala. Another way you might be able to get access directly is using $_SERVER['QUERY_STRING'];
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: $_GET information that includes "&" and "="
Don't forget [SOLVED] 