Page 1 of 1

Session, Functions and Includes

Posted: Tue Jan 18, 2011 11:23 am
by $var
Hello, I am hitting a wall!

I am implementing a captcha in a form that is being called in a template via include.
eg: index.php includes form.php

Form PHP doesn't have any <head></head> or similar mark-up, it's just a form with PHP processing at the bottom.

I am calling the captcha function at the top of the form.php page, but it always fails processing with no errors.
When I put the form code in a test.php page that calls the captcha function and include before the HTML DOC, it succeeds.
When I put the captcha function in index.php before the HTML DOC and include form.php, captcha check fails with the error called to undefined function.

This leads me to believe that it's not allowed to assign a function at the top of the main index because it doesn't pass that along to the include, and that because the include doesn't have proper HTML mark-up for a complete page that it can't work properly.

Can you help explain this, am I right in my understanding? If so, I have to change how I am doing things.

Re: Session, Functions and Includes

Posted: Tue Jan 18, 2011 11:58 am
by Jonah Bron
Without seeing the code, it's impossible to say. But if it's giving you an undefined function error, it's safe to assume that some file isn't being included.

Re: Session, Functions and Includes

Posted: Tue Jan 18, 2011 12:09 pm
by Technical
Post your code, please, so we can tell what is the problem.

Re: Session, Functions and Includes

Posted: Tue Jan 18, 2011 12:48 pm
by $var
I just went about it another way.
I tried by-passing the include altogether but it still failed the captcha.

I think it has to do with Drupal corrupting it somehow.

Thanks anyway!