Re: passing a variable with php_self
| From: | Torgny Bjers | Date: | Tue, 27 Sep 2005 13:17:33 +0000 |
| Subject: | Re: passing a variable with php_self | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-223268@lists.php.net to get a copy of this message | ||
Ross wrote:
> can someone show me the right way to do the following...
>
> <a href="<?=$PHP_SELF?action=bigger; ?>">
>
> I want to pass a variable to a self submitting link.
Easiest way to do that is to use sprintf() or printf():
<?php
$link_title = "click my self-referring link";
printf('a href="%s?action=bigger">%s</a>',
$_SERVER['PHP_SELF'],
$link_title);
?>
Or, like you did with inline code in the HTML:
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=bigger">click my
self-referring link</a>
Warm Regards,
Torgny