Using HTML and PHP to send form data to an email

前端 未结 4 1942
感情败类
感情败类 2021-01-03 15:01

Like the title says, sending a form to my email. I get no errors, but the email never comes. Here\'s my HTML form (I don\'t think you\'ll need anything else, but there is al

4条回答
  •  旧巷少年郎
    2021-01-03 15:11

    Try add in top file: error_reporting(E_ALL);

    and edit your code, see:

    if(mail($to,$email_subject,$email_body,$headers)){
        //redirect to the 'thank you' page
        header('Location: contact-form-thank-you.html');
    } else {
        echo 'Error!';
    }
    

    Read this:

    • http://www.php.net/manual/en/function.error-reporting.php

    • http://www.php.net/errorfunc

    • http://php.net/manual/pt_BR/function.set-error-handler.php

    • http://www.php.net/register_shutdown_function

提交回复
热议问题