-
Custom PHP forms
Hi,
I am wanting to run a custom form written in PHP from within an article.
I have placed the php file in the templates folder and used the insert tag:
{{file::contact.php}}
in the article's HTML area.
This works fine, but on submitting the form I get the 403 error:
Forbidden
You don't have permission to access /RMCTypolight/templates/contact.php on this server.
The form action calls the file contact.php, i.e. the same php file that the form resides in.
Anyone able to help?
-
Re: Custom PHP forms
Hi gregu,
i never made something like that. But i think you must use the link (the submitting) again to an TL side and an inserttag. The same page as the form is in I think.
Otherwise you would be abel to use that file without an inserttag at the first time ;-)
regards
-
Re: Custom PHP forms
Access to files in template directory is forbidden by .htaccess in that directory and you shouldn't try remove it, as it is important for security.
Just make sure that form action points to typolight page containing your form. I believe action="#" will work fine. Then just check if form was submitted and do whatever you want in your contact.php.
-
Re: Custom PHP forms
Thanks for the replies. I ended up solving it by using action="$_SERVER[PHP_SELF]" in the form tag ("#" did not work for me).