当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - I have an html contact form. How do I make it so when someone clicks "send message" it will run a php script sending it to my email?

问题描述:

This question already has an answer here:

  • Send email with PHP from html form on submit with the same script

    8 answers

网友答案:

It looks like you are looking for the mail() function.

<?php
$to      = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

The PHP manual: http://php.net/manual/en/function.mail.php

网友答案:

Replace the <a> with the <button> tag.

<ul>
    <li>
        <button type="submit" class="send"><i class="fa fa-share"></i>Send Message</button>
    </li>
</ul>
分享给朋友:
您可能感兴趣的文章:
随机阅读: