my website is in php , sql.... www.test.com/index.php..i want to retrieve ' index.php' from the url into an html page ... and use it as a link... ie if i am on www.test.com/site.php. ...i want to retrieve only the ' site.php' of the url.... how can it b done?? pls hellp........
You can do this in php. To retrieve strings from url's, make use of php predefined variables. A list is over here at: http://uk2.php.net/reserved.variables To get the page from the url you can simply use this script $pagename=pathinfo($_SERVER["PHP_SELF"]); $pagename=$pagename["basename"]; and then echo the variable pagename like so: echo $pagename; There are many useful variables already built in, ensure you make full use of them
thank u... i am able to retrieve the base of url using $pagename=pathinfo($_SERVER["PHP_SELF"]); $pagename=$pagename["basename"]; but i want to use the value of $pagename in place of "----" in the below shown line of code...... <a href="-----"><img src="arabic.gif" border="0" alt="" /></a> how can i do it???pls help.........
If you wanted to do that then why did you need the specific page name? :S You can use it like this though: <a href="<?php $pagename ?>"><img src="arabic.gif" border="0" alt="" /></a>
Thank u for ur help... i tried doing that...but its not working... <a href="<?php $pagename ?>"><img src="arabic.gif" border="0" alt="" /></a> when i use this code... it is directing only to the index.php of the site.. when i am in the site.php or whatever page i am viewing then and clicking the link it is directing to index.php pls help......