Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem passing variables to a function

Status
Not open for further replies.

TheDust

Programmer
Aug 12, 2002
217
US
I'm a pretty seasoned PHP programmer, but I'm at my wit's end with this problem... it makes no sense to me why this is happening:

I am trying to pass a variable to a function included in an include file and it is NOT happening. Here is the function, included in my codelib.php file (which is outside of the web root):

function send_mail($myname) {
echo "TEST: ".$myname;
}

Here is the call to the function (in a page within the web root):

$fromName = "something cool";
send_mail($fromName);

The output of the function is simply:

TEST:

I was trying to get a mailing script to work, but I've broken it down to this simple of a function. The variable is NOT getting passed. It doesn't make sense because I have other functions in the include file that work fine all over the site. I know this is going to seem like a ridiculous problem to most, but I don't know what else to do right now... I'm lost.
 
Also, I'm including my code library with this at the top of the page:

include ("../codelib.php");
 
OK never mind... it's working now for UNKNOWN reasons... maybe there's a chance the server admins were messing around with the PHP installation? I don't know.

Sorry about taking up board space.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top