ok, that makes sense now:



<?

function dataQuery($param) {
$value = "results from $param";
return $value;
}

function passDataQuery($url,$param) {
$results = dataQuery($param);
$urlstring_new =  "<a href=".$url."?".$param."=".$results.">Link
Description</a>";
return $urlstring_new;
}


$script = "asdfasdf.php3";
$varname =      "TESTNAME";
echo passDataQuery($script,$varname);

?>

you could alternately perform the dataQuery statements with passDataQuery.

DanO

-----Original Message-----
From: Abe [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 11, 2001 1:59 PM
To: DanO; [EMAIL PROTECTED]
Subject: Re: [PHP] Function -> Sending URL's


Hey Dan

You see in this example - the value of $company is coming from the script
and not the function - I am trying to find a way of telling the function
which variable I want to use, but the value for that variable to come from
the function for exmaple:

I want to tell the function -
'here is the name of the link, here are the variables to attach onto the end
of it - but work out the values yourself!'

Does that makes sense - I can't find a way to do that.

Thanks,
Abe

----- Original Message -----
From: "DanO" <[EMAIL PROTECTED]>
To: "Abe" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, January 11, 2001 9:41 PM
Subject: RE: [PHP] Function -> Sending URL's


>
> sorry, but i didn't fully understand what you are trying to do.
>
> you can also pass 2 variables to the function:
>
> <?
> function testPassVar($url,$param) {
> echo "<a href=";
> echo $url;
> echo "?name=";
> echo $param;
> echo ">Click Here</a>";
> }
>
> $script = 'asdfasdf.php3';
> $company = 'TEST';
> testPassVar($script,$company);
> ?>
>
>
>
> -----Original Message-----
> From: DanO [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 11, 2001 1:35 PM
> To: Abe; [EMAIL PROTECTED]
> 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:[EMAIL PROTECTED]]
> Sent: Thursday, January 11, 2001 1:35 PM
> To: [EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to