0

I have a rather large form built, and unfortunately my friend is using WordPress. After much research of how to get PHP to run on an individual page, I created a custom template for the page and inserted my PHP which is to read that it was a post, and send a wp_email accordingly.

My form starts out:

 <form name="healthyOrderForm" method="POST" action="/order-sent"  enctype="text/plain">

the /order-sent does send it to the correct page as I can see my php response when it gets there. Form submit button is:

<input type="submit" name="send" value="Submit Order" />

PHP is:

 <?php
if (isset($_POST['submit'])) {
    $to = 'testemail@gmail.com';
    $subject = 'New Healthy Order';
    $message .= 'Location: ' . $_POST['location'] ;
    $headers = "From: randomemail@gmail.com\r\n";
    $headers .= 'Content-Type: text/plain; charset=utf-8';
    $success = wp_mail( $to, $subject, $message, $headers);

}
?>

Any help would be greatly appreciated as I have been stuck on this for over 24 hours now.

  • 1
    Why is it unfortunate that your friend is using Wordpress? And what exactly is the problem you're having? – Lee Jan 07 '15 at 16:27
  • The problem is that the email is not sent would be the problem (I just like building from scratch, less restrictions) – user1231771 Jan 07 '15 at 16:30
  • Using error reporting http://php.net/manual/en/function.error-reporting.php would signal a few things. Something you're not doing. – Funk Forty Niner Jan 07 '15 at 16:30

1 Answers1

3

You have no $_POST['submit']. The name of your submit is $_POST["send"]. Check on that.

EDIT

And, as Fred-ii- pointed me to that, remove the enctype="text/plain" from your form tag.

vaso123
  • 12,347
  • 4
  • 34
  • 64