我写了一个HTML表单,只包含一个电子邮件字段.我想转移用户的电子邮件
输入到我的Web服务器上的文本文件中.
当我单击“提交”按钮时,我得到一个白屏.什么都没有写入我的文本文件.
当他们单击提交按钮时,我也想将用户重定向到另一个页面.
这可能吗?我是新手.
$file = fopen("emaillist.txt","a+");
fwrite($file,$email);
fclose($file);
print_r(error_get_last());
?>
解决方法:
除了Andy G所说的更改“提交”按钮的名称外:
//Get the email from POST
$email = $_REQUEST['email'];
$file = fopen("emaillist.txt","a+");
fwrite($file,$email);
print_r(error_get_last());
//redirect
header("Location: http://www.example.com/");
在
标签:forms,text,html,php
来源: https://codeday.me/bug/20191123/2064079.html