Re: calling PHP self with a text link
| From: | Jasper Bryant-Greene | Date: | Fri, 02 Sep 2005 07:02:40 +0000 |
| Subject: | Re: calling PHP self with a text link | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-221740@lists.php.net to get a copy of this message | ||
Ross wrote:
I want call the current page and set a variable (or call a function) < a href="index.php?variable=bananas" -this works but means I have to change it for every page name I have tried <a href="<? $PHP_SELF(); ?>">this is the link</a>What's wrong with <a href="<?php print($_SERVER['PHP_SELF']); ?>?name=val">link</a> By the way, you can't trust PHP_SELF, so you might want to escape or validate that variable. See [1], mentioned recently by Chris Shiflett on this list. [1] http://blog.phpdoc.info/archives/13-XSS-Woes.html -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ If you find my advice useful, please consider donating to a poor student! You can choose whatever amount you think my advice was worth to you. http://tinyurl.com/7oa5s