August 18, 201115 yr This is odd. I've created a form on a Wordpress page, it POSTs to filename.php. Filename.php is basically a page template that should then display the information submitted. However, doing it this way it doesn't work, complaining that "get_header" etc are all undefined. It would seem that whatever file you're POST'ing too, can't use Wordpress functions. Any ideas on this? Workarounds? Doesn't seem quite right to me... I also tried making a page, setting the PHP file as the pages template, then POSTing to that, but that just loads the homepage :S however if you then refresh you get the right page - but minus the form information. Edited August 18, 201115 yr by brightonmike
August 18, 201115 yr Author I can't give you a link, but basically, imagine you have your action file, e.g. <form id="homequoteform" action="<?php bloginfo('template_directory'); ?>/contactengine.php" method="post"> In that file, you want to echo the fields the user has typed in. You obviously don't want it to be a blank white page displaying the fields, so you reference your WP header/footer etc. That's what doesn't work. However, I am thinking of not doing it this way....though it'd still be interesting to find out why you can't POST to a php file that uses Wordpress functions.
August 18, 201115 yr Hmmm i had no idea it didn't work to be honest as i've not come across it. This is probably a question for Chris (RenaissanceDesign) lol
Create an account or sign in to comment