简体   繁体   中英

Hi, I am making a contact form thingy, and my php isn't working any reason why?

Error: 在此处输入图像描述

the code:

<?php 

    $name = $_POST['name'];
    $mail = $_POST['mail'];
    $message = $_POST['message'];

    $to ="bejidev27@gmail.com";
    $subject = "New contact from " .$name;
    $body = "";
    
    $body .= "Name : " .$name. "\r\n";
    $body .= "Email : " .$mail. "\r\n";
    $body .= $message. "\r\n";
    
    if($mail !=NULL){
    mail($to, $subject, $body);
    header("Location: index.html")  ;
    header("Location: done.html")  ;
}

?>

It's not sending the mail nor the page is working i need help ,thanks in advance :D

First, check if your servers are running properly. Then, for the following

$name = $_POST['name'];
$mail = $_POST['mail'];
$message = $_POST['message'];

There need to be values for each you. If you are getting the values from a form, then you have to handle the form first using the 'isset' function, to be able to pass the values to each variables.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM