[英]How can i send the entered form data to my email adress?
How can i send a email to the person that enters his information in a php form. 我如何向以php形式输入其信息的人发送电子邮件。 that his form data is saved.
他的表单数据已保存。 and also send an email to the webmaster with all the entered form data.. this is what i tried so far:
并向电子邮件发送给网站管理员,其中包含所有输入的表单数据。.这是我到目前为止尝试过的:
mail($email, $subject, $autoreply);
mail($default, $subject, $autoreply, $naam, $email, $telefoon_nr, $adres, $email_partner);
Say you have a form. 假设您有一个表格。
<form action="somefile.php" method="post">
<input type="text" name="firstname" id="firstname">
<input type="text" name="lastname" id="lastname">
<input type="number" name="age" id="age">
<input type="submit" name="submit" id="submit" value="Submit">
</form>
Now your PHP file can handle it. 现在,您的PHP文件即可处理它。
somefile.php: somefile.php:
<?
if (isset($_POST['submit'])){
$first = $_POST['firstname']; $last = $_POST['lastname'];
$age = $_POST['age'];
$body = "First name: ".$first." Last name: ".$last." Age: ".$age;
mail("example@example.com", "sample subject", $body);
}
?>
You can see the parameters of the mail
function in the documentation . 您可以在文档中看到
mail
功能的参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.