邮件列表订阅

我在我的网站上有这个部分,号召性用语是:


“订阅我的邮件列表,以便通知我的完整网站何时发布。


如何收集电子邮件地址并将其保存到文件中(我猜它需要某种php或其他服务器端语言)


代码如下


<div class="right">

                <p class='attention'>Website to be released <br>early-mid 2020!</p>

                <form action="mailto" method="post" enctype="text/plain">

                <input type="text" name='email' id='email' placeholder="your email">

                <button type="submit">Notify Me</button>

            </form>

            </div>


白衣染霜花
浏览 73回答 1
1回答

米脂

这是非常特定于您的要求,它将帮助您将电子邮件ID保存到项目目录中的文件“data.txt”。<!DOCTYPE html><html><head><title>Store form data in .txt file</title></head><body>&nbsp; &nbsp; <div class="right">&nbsp; &nbsp; &nbsp; &nbsp; <p class='attention'>Website to be released <br>early-mid 2020!</p>&nbsp; &nbsp; &nbsp; &nbsp; <form method="post">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="text" name='email' id='email' placeholder="your email">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <button type="submit" name="submit">Notify Me</button>&nbsp; &nbsp; &nbsp; &nbsp; </form>&nbsp; &nbsp; </div></body></html><?phpif(isset($_POST['submit'])){$data=$_POST['email']. PHP_EOL;$fp = fopen('data.txt', 'a');fwrite($fp, $data);fclose($fp);}?>
打开App,查看更多内容
随时随地看视频慕课网APP