Re: Function -> Sending URL's
| From: | Abe | Date: | Thu, 11 Jan 2001 21:46:20 +0000 |
| Subject: | Re: Function -> Sending URL's | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-34106@lists.php.net to get a copy of this message | ||
No, that wont work - unfortunately the purpose of the function is to read
the values from a database then add them to the URL.
So the URL is sent to the function - but the values within the URL will come
from the database which is accessed from within the function.
Thanks,
Abe
----- Original Message -----
From: "DanO" <dano@informano.net>
To: "Abe" <abe@fish.tm>; <php-general@lists.php.net>
Sent: Thursday, January 11, 2001 9:34 PM
Subject: RE: [PHP] Function -> Sending URL's
>
> you are assigning the variable within the function, then calling the
> function with the variable.
>
> this is a variable scoping issue.
>
> try this:
>
> <?
> function testPassVar($url) {
> echo "<a href=\"$url\">Click</a>";
> }
>
> $company = "TEST";
> $url = 'asdfasdf.php3?name='.$company;
> testPassVar($url);
> ?>
>
>
>
> -----Original Message-----
> From: Abe [mailto:abe@fish.tm]
> Sent: Thursday, January 11, 2001 1:35 PM
> To: php-general@lists.php.net
> Subject: [PHP] Function -> Sending URL's
>
>
> Hey there,
> this is a strange one - I want to send a URL to a function that includes
> varibles. Those variables should be taken from within the function - as
in
> the example below the link I want is:
>
> asdfasdf.php3?name=TEST , but that is not what I get as you can see.
>
> Does anybody know a way around this - The example is simpler than what I
am
> actually doing and the value of $company must come from the variable.
>
> Thanks,
> Abe
>
>
>
> <?
> function testPassVar($url) {
> $name = "TEST";
> echo "<a href=\"$url\">Click</a>";
> }
>
> $url = 'asdfasdf.php3?name=$company';
> testPassVar($url);
> echo "This is a $name";
> ?>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>