Re: Function -> Sending URL's

From: Date: Thu, 11 Jan 2001 23:37:31 +0000
Subject: Re: Function -> Sending URL's
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-34150@lists.php.net to get a copy of this message
> <? > function testPassVar($url) { > $name = "TEST"; > echo "<a href=\"$url\">Click</a>"; > } > > $url = 'asdfasdf.php3?name=$company'; > testPassVar($url); > echo "This is a $name"; > ?> > $url = "asdfasdf.php3?name=$company"; you need double quotes for the $company to be eval'd also, $name is defined within a function, which means you don't have access to it from the "outside world" can you give a little more detail? -alex -- Alex Black, Head Monkey enigma@turingstudio.com The Turing Studio, Inc. http://www.turingstudio.com vox+510.666.0074 fax+510.666.0093 Saul Zaentz Film Center 2600 Tenth St Suite 433 Berkeley, CA 94710-2522 > From: abe@fish.tm ("Abe") > Newsgroups: php.general > Date: 11 Jan 2001 13:25:43 -0800 > 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 >

« previous php.general (#34150) next »