473,396 Members | 1,913 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,396 software developers and data experts.

Return current page and variables: $PHP_SELF dose not do it.

If my current page is:
http://www.domainname.com/index.php?...=mfrs/register
$PHP_SELF returns:
index.php
What function can I use to return:
index.php?menu=man&pageid=mfrs/register

Thanks for your help.
Seth

Jun 8 '06 #1
10 6425
"Seth" <se****@gmail.com> writes:
If my current page is:
http://www.domainname.com/index.php?...=mfrs/register
$PHP_SELF returns:
index.php
What function can I use to return:
index.php?menu=man&pageid=mfrs/register


I think you want $_SERVER["PHP_SELF"] . $_SERVER["QUERY_STRING"]

you can see them all if you do a phpinfo();

--
Henrik Hansen
Jun 8 '06 #2
Hang on, what about '$PHP_SELF?menu=man&pageid=mfrs/register' ?

Henrik Hansen wrote:
"Seth" <se****@gmail.com> writes:
If my current page is:
http://www.domainname.com/index.php?...=mfrs/register
$PHP_SELF returns:
index.php
What function can I use to return:
index.php?menu=man&pageid=mfrs/register


I think you want $_SERVER["PHP_SELF"] . $_SERVER["QUERY_STRING"]

you can see them all if you do a phpinfo();

--
Henrik Hansen


Jun 8 '06 #3

strawberry wrote:
Hang on, what about '$PHP_SELF?menu=man&pageid=mfrs/register' ?


That will return '$PHP_SELF?menu=man&pageid=mfrs/register'

try $PHP_SELF.'?menu=man&pageid=mfrs/register'
or "$PHP_SELF?menu=man&pageid=mfrs/register"

Jun 8 '06 #4
Henrik Hansen wrote:
I think you want $_SERVER["PHP_SELF"] . $_SERVER["QUERY_STRING"]


I use $_SERVER["PHP_SELF"] . ($_SERVER["QUERY_STRING"] != '' ? '?' .
$_SERVER["QUERY_STRING"] : '')

Jun 9 '06 #5
"strawberry" <za*******@gmail.com> writes:
Hang on, what about '$PHP_SELF?menu=man&pageid=mfrs/register' ?


thats hardcoded, I think he want to use a dynamic solution, if ex. the
url changes etc. And why hardcode it when you got all the info in the
server array.

--
Henrik Hansen
Jun 9 '06 #6
"the DtTvB" <me********@gmail.com> writes:
Henrik Hansen wrote:
I think you want $_SERVER["PHP_SELF"] . $_SERVER["QUERY_STRING"]


I use $_SERVER["PHP_SELF"] . ($_SERVER["QUERY_STRING"] != '' ? '?' .
$_SERVER["QUERY_STRING"] : '')


Right, thats probably more correct, if the query string is empty at times ..

--
Henrik Hansen
Jun 9 '06 #7
sorry about the inverted commas. I meant by them to say use the text
within them.

As for a dynamic solution - substitute 'man' with $man or {$row['man']}
or whatever and you've got a dynamic solution.

No doubt, the other method provided is more correct and more dynamic I
just thought the OP might appreciate the simplicity of this solution -
at least in terms of implementation relative to what they had already.
Actually I'll use the SERVER method myself once I figure out how to
implement it! Until then the method I describe works just fine for me.

Cheers,

Henrik Hansen wrote:
"strawberry" <za*******@gmail.com> writes:
Hang on, what about '$PHP_SELF?menu=man&pageid=mfrs/register' ?


thats hardcoded, I think he want to use a dynamic solution, if ex. the
url changes etc. And why hardcode it when you got all the info in the
server array.

--
Henrik Hansen


Jun 9 '06 #8
I´d also suggest the $_SERVER['QUERY_STRING'] solution. But if that´s
something you need on every page of your website, maybe a session with
those variables would be the better solution.

Jun 9 '06 #9
Henrik Hansen <sp**@fsck.dk> wrote in news:87************@fsck.dk:
"the DtTvB" <me********@gmail.com> writes:
Henrik Hansen wrote:
I think you want $_SERVER["PHP_SELF"] . $_SERVER["QUERY_STRING"]


I use $_SERVER["PHP_SELF"] . ($_SERVER["QUERY_STRING"] != '' ? '?' .
$_SERVER["QUERY_STRING"] : '')


Right, thats probably more correct, if the query string is empty at
times ..

Is the above method better or worse than $_SERVER['REQUEST_URI'];
--
Karl Groves
www.karlcore.com
Jun 9 '06 #10
Karl Groves:
Is the above method better or worse than $_SERVER['REQUEST_URI'];


If you want to grab part of the URL, I'd use your REQUEST_URI or
QUERY_STRING, since PHP_SELF corresponds to the URL by coincidence
only.

--
Jock

Jun 9 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Matthew Robinson | last post by:
the page below returns just the search box everytime. ive not attempted to code the text search yet, but i want it to beable to filter out the category's, but its just not showing any. any idea's...
0
by: Antoni | last post by:
Hello, I wondered if anyone could advise? I am trying to write a basic script, which allows user's to enter there username, password in text fields. Then we take these values and pass them to...
3
by: Antoni | last post by:
Hello, I wondered if anyone could advise? I am trying to write a basic script, which allows user's to enter there username, password in text fields. Then we take these values and pass them to...
3
by: Dave | last post by:
guys say if I include("anyfile.php") into a file. Is it possible for me to access the calling page from anyfile.php. Can I do something like this for instance:: if callingpage ==...
8
by: ALI-R | last post by:
How do I allign all my content in aspx page in the middle of page like a lot of websites ? Dose it work with differnet screen resolutions? Thanks for your help.
0
by: bindslind | last post by:
The script does most of what it's supposed to do, but I have what seems to be a simple problem that I can't figure out. When the page intitially loads the first page does not display images. The same...
4
by: dac | last post by:
I am quietly going insane on this project. I've never worked on a project like this one before. All my previous sticky forms were for data entry, not editing. I don't know how to display the form...
3
by: ft310 | last post by:
This might be the dumb one for the day but, I need a PHP function (or whatever) similar to the JavaScript "self.location" in PHP. Will someone please put me out of my misery. Thanks
16
by: Alan Jones | last post by:
Hello everyone, any help would be greatly appreciated. :) What I'm trying to do may not be advisable, but here goes... I want a page named signature.php to appear conditionally as an include...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.