|
Posted by Pedro Graca on 11/11/06 17:17
matt wrote:
> Pedro Graca wrote:
>> matt wrote:
>>>
>>> Yet the $download seems to pass into the function and display fine!!
>>
>> I'd have to take a look at your script to understand why.
>> Maybe tomorrow, no promises.
>>
> Thanks, I have added in the line you have put there, but it still just
> prints a blank space. I appreciate your help.
Increase the level reporting level of your script.
Add these two lines right after the first php opening tag
error_reporting(E_ALL);
ini_set('display_errors', '1');
When you get it working, remove the lines. Better yet would be to set
error_reporting and related configuration stuff turned on for the
development machine and off for the server.
At some point in your code you call email_admin().
Are the variables $usrname and $usremail set at the time of the call?
echo '<pre>'; var_dump($usrname, $usremail), echo '</pre>';
email_admin($usrname, $usremail);
When I trimmed your code to 50 lines (just the email_admin() and a few
ifs left from the original code, no `global` or $GLOBALS stuff), the
$usrname and $usremail variables were correctly set inside the
admin_email() function.
function email_admin($usrname, $usremail)
{
$usrname = $GLOBALS["usrname"];
$usremail = $GLOBALS["usremail"];
$download = $GLOBALS["download"];
Huh? ??!?!?!?!?
Why are you copying from $GLOBALS to the function parameters?
Sprinkle a few debugging lines throughout the code to find out what it
is doing with the `global` and $GLOBALS stuff.
First define a function for easy debugging:
function debug(&$var, $line) {
echo '<pre>', 'DEBUGGING line ', $line, ': ';
print_r($var);
echo '</pre>';
}
Then use that function in relevant places in your code:
function email_admin($usrname, $usremail)
{
debug($usrname, __LINE__);
$usrname = $GLOBALS["usrname"];
debug($usrname, __LINE__);
// ...
}
The code you posted is a big mess :(
I suggest you break it into (small) functions, stop relying on
register_globals, do not use $GLOBALS or global declarations at all.
--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Navigation:
[Reply to this message]
|