I know this question has been asked many times and also answered. I made exactly what I have learnt from more than a tutorial. And after reading many questions/answers all over forums and communities online, I still have an error with my php script. The thing is that I want to be able to send what a user enters in a textfield to my email by php.
我知道这个问题已被多次询问并且也回答了。我完全从教学中学到的东西。在网上论坛和社区阅读了很多问题/答案后,我的php脚本仍然出错。问题是我希望能够通过php将用户在文本字段中输入的内容发送到我的电子邮件中。
Here is my php
这是我的PHP
<?php
$mail = $_POST['mail']
$formcontent = "Email: $mail";
$recipient = "angrybullet2.webhosting@gmail.com";
$subject = "Mail that uploaded picture";
$mailheader = "From: my website";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo 'OK ! Your mail address has been successfully added to your photo !<br>We will contact you later :)';
?>
Here is my HTML
这是我的HTML
<form name="form" id="login" method="POST" action="t.php">
<input type="text" name="mail" id="mail" size="70">
<input type="submit" name="submit" id="submit" value="submit">
</form>
When I web host those codes, It said error on line 3 of the php. Can anybody please help me? Thanks in advance :) Any help will be appreciated.
当我在网站上托管这些代码时,它说的是PHP第3行的错误。有人可以帮帮我吗?在此先感谢:)任何帮助将不胜感激。
1 个解决方案
#1
1
Something is wrong in your code.
你的代码有问题。
Change line 2 to
将第2行更改为
$mail = $_POST['mail'];
You forgot ;
at the end of line 2.
你忘了 ;在第2行的末尾。
#1
1
Something is wrong in your code.
你的代码有问题。
Change line 2 to
将第2行更改为
$mail = $_POST['mail'];
You forgot ;
at the end of line 2.
你忘了 ;在第2行的末尾。