<script language="javascript">
alert(window.location);
document.write("<form><input type='hidden' name='currURL' value='" + window.location + "'></form>");
this will alert the location and write it to a hidden field. Hope this gives you some ideas. When php runs there really isn't a current url, the php is creating it.
If you are looking for ideas about referrer or the previous url have a look at some of the tutorials.