Session, Functions and Includes
Posted: Tue Jan 18, 2011 11:23 am
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.
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.