470,811 Members | 1,030 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,811 developers. It's quick & easy.

Page reloading problem

Hi All,
Here's my problem. I'm having trouble managing the additional variables
on the end of my URL. For example, I might have a URL like the following:

http://www.mydomain.com/index.php&option1=5&option2=7

It's the 'option' variables I'm having problems with. I would typically use
variables of this form to control various aspects of the current page.
However, the actual options present will be dependant on the current mode of
the page. Now lets say that I want to put a link on my page that adds a new
'option3' variable and reloads the page. The php might look like:
echo '<A
HREF="'.$_SERVER['PHP_SELF'].'?'.SID.'&option1=5&option2=7&option3=6'."\">ne
w link with new option</A>\n";

But I can't really use this because this page might not actually contain
option1 and option2 - it may have option5 and option6 instead. What I want
to be able to do is to leave the current options alone and just add the ones
I want to add. What is the best way of doing this?.

I reckon the best way to handle it would be to have a $_SERVER variable that
would give me the full current URL including all of the options. That way I
could a line similar to:

echo '<A HREF="'.$_SERVER['FULL_URL'].'?'.SID.'&option3=5'."\">new link with
new option</A>\n";

and it would just work. Is there such a variable?, or is there a better way
of doing this?.

Ta in advance,
Dave

Dec 20 '05 #1
1 1178
On Tue, 20 Dec 2005 22:56:42 +0000, Dave Moore wrote:
and it would just work. Is there such a variable?, or is there a better way
of doing this?.


What is wrong with $_SERVER['PHP_SELF']?

--
http://www.mgogala.com

Dec 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Urs Vogel | last post: by
3 posts views Thread by Richard | last post: by
6 posts views Thread by Jorge Luzarraga Castro | last post: by
8 posts views Thread by Salvatore Sanfilippo | last post: by
2 posts views Thread by Code Monkey | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.