jQuery AJAX form using mail() PHP script sends email, but POST data from HTML form is undefined

前端 未结 6 1618
青春惊慌失措
青春惊慌失措 2020-11-27 05:07

Thanks for taking the time to look, guys. I\'m creating a pretty basic AJAX contact form using jQuery. The email sends, but upon opening the email there is no POST data, so

6条回答
  •  余生分开走
    2020-11-27 05:37

    You are using the wrong parameters name, try:

    if($_POST){
        $name = $_POST['name'];
        $email = $_POST['email'];
        $message = $_POST['text'];
    
    //send email
        mail("j.andrew.sears@gmail.com", "51 Deep comment from" .$email, $message);
    }
    

提交回复
热议问题