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

How to read the current query (URL)

Hi,
I try to create a dynamic webpage as dynamic as possible.
Now I want to create a script which manage a content navigation.
My problem is: How do read the current URL query.
For example: The current open file is: http://www.xyz.com/test.php
Now I want to create an variable which contents "test.php"

I know, there are several methods with the file functions to read a path
.... but how do I get the complete URL out of the query into a variable?

Thx for help
Sorry, my english isn't very well

Martin

Jul 17 '05 #1
4 10337
M.Braun wrote:
My problem is: How do read the current URL query.
For example: The current open file is: http://www.xyz.com/test.php
Now I want to create an variable which contents "test.php"

I know, there are several methods with the file functions to read a path
... but how do I get the complete URL out of the query into a variable?


Use the $_SERVER auto global array, specifically the

$_SERVER['PHP_SELF']

But have a look at all of the available stuff in there:

<?php
echo '<pre>';
print_r($_SERVER);
echo '</pre>';
?>
--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2
"M.Braun" <br***@uni-koblenz.de> wrote:
I try to create a dynamic webpage as dynamic as possible.
Now I want to create a script which manage a content navigation.
My problem is: How do read the current URL query.
For example: The current open file is: http://www.xyz.com/test.php
Now I want to create an variable which contents "test.php"

I know, there are several methods with the file functions to read a path
... but how do I get the complete URL out of the query into a variable?


$_SERVER['SCRIPT_NAME']
$_SERVER['PHP_SELF']
__FILE__

http://uk.php.net/manual/en/function.basename.php

JOn
Jul 17 '05 #3
A day doesn't go by without someone asking this same question...

The variables that you give you the complete URL are $_SERVER['HTTP_HOST']
and $_SERVER['REQUEST_URI'].

Uzytkownik "M.Braun" <br***@uni-koblenz.de> napisal w wiadomosci
news:c3***********@news.uni-koblenz.de...
Hi,
I try to create a dynamic webpage as dynamic as possible.
Now I want to create a script which manage a content navigation.
My problem is: How do read the current URL query.
For example: The current open file is: http://www.xyz.com/test.php
Now I want to create an variable which contents "test.php"

I know, there are several methods with the file functions to read a path
... but how do I get the complete URL out of the query into a variable?

Thx for help
Sorry, my english isn't very well

Martin

Jul 17 '05 #4
Chung Leong wrote:
A day doesn't go by without someone asking this same question...

The variables that you give you the complete URL are
$_SERVER['HTTP_HOST'] and $_SERVER['REQUEST_URI'].

So then what is getenv("REQUEST_URI") used for? I thought that's what I
should use to verify the current page's URL. Are you saying that the
$_SERVER way is better for this? Also, is either one of these methods
utilizing register globals? I want to try and stay away from using the
globals way of doing things, and so many of the tutorials on the net are
taking this 'easy way'.
--
Joel Farris | Q: It reverses the logical flow of conversation.
twinkledust Designs | A: Why is top posting frowned upon?
http://twinkledust.com |
AIM chat: FarrisJoel |
| (this fifth line in my sig angers the net kops!)

Jul 17 '05 #5

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

Similar topics

3
by: Silvio Lopes de Oliveira | last post by:
Hello, I have a C++ / MFC app which uses CDatabase and CRecordset to connect to a ODBC data source for a SQL Server 7 database. The application worked properly with a MySQL database, but after...
2
by: Sandman | last post by:
Just looking for suggestion on how to do this in my Web application. The goal is to keep track of what a user has and hasn't read and present him or her with new material I am currently doing...
3
by: Vic | last post by:
Dear All, I have a database of laboratory records in Access 2000. There is one form which acts as an interface to input experimetal data. This form incorporates information from several tables....
2
by: trint | last post by:
while (drSQL.Read()) { In here I need to start a new query on a different table. } How can I do that? Thanks, Trint
6
by: sghi | last post by:
Hi All, I'm new to this group and quite new to access/vba. So, shortly after beginning to write a simple application for my wife, I came across a blocking problem: I need to intercept the sql...
5
by: troy | last post by:
Could someone please point me in the right direction on how to read in a large query with .net. I am trying to emulate a legacy database system so I don't know the upper bounds of the sql query....
7
by: Igor | last post by:
1. In this topic...
3
by: sam | last post by:
same as subject?
9
by: dizzydangler | last post by:
Hi, all! After receiving a lot of help from ADezzi, Msquared, and NeoPa getting my ms access 2007 db functioning, I've run into another hitch that I haven't been able to solve. The database itself...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.