Reputation: 53
I'm trying to make a custom contact form using a custom page template in WordPress. When I use
<?php echo $_SERVER['PHP_SELF']; ?>
it goes from the contact page to the index page. When I leave action empty like
action=""
it gives me an error. Can anyone give me some insight on this? I can post the whole page if you you'd like. I read similar post but didn't find a solid answer. Thanks in advance.
Upvotes: 2
Views: 1064
Reputation: 131
Use $_SERVER['REQUEST_URI']
instead of PHP_SELF. WordPress rewrites everything to it's index.php, so you need to post to the current url and not the index.php.
Upvotes: 2