Solved

Get the current url with query strings PHP

Posted on 2010-08-15
6
234 Views
Last Modified: 2012-05-10
How to get the current url with query strings?

I tried  PHP_SELF didn't work :(
0
Comment
Question by:sahanz
  • 3
  • 2
6 Comments
 
LVL 30

Expert Comment

by:Marco Gasi
ID: 33439631
What have you done, exactly? PHP_SELF or $_SERVER['PHP_SELF']?
0
 
LVL 1

Author Comment

by:sahanz
ID: 33439632
$_SERVER['PHP_SELF']
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 250 total points
ID: 33439637
Looks like on this Windows IIS machine you need two $_SERVER variables to get everything.  Looks like that should work on Linux/Apache also.
$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]

Open in new window

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 30

Assisted Solution

by:Marco Gasi
Marco Gasi earned 250 total points
ID: 33439639
Take a look at this function http://www.webcheatsheet.com/PHP/get_current_page_url.php

You can also use $_SERVER['REQUEST_URI'] but I'm not sure (never used :-))

Hope this helps
0
 
LVL 1

Author Closing Comment

by:sahanz
ID: 33439644
Its apache and $_SERVER['REQUEST_URI'] gives the URL with query
0
 
LVL 1

Author Comment

by:sahanz
ID: 33439647
and thanks btw :)
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now