The form in my HTML file needs to send data to the PHP file for processing, but every time on the browser page, the code of the PHP file is displayed, and this data is not processed.
Like this:
When I put these files on the server for access, they all display:
HTML:
<form action="survey.php" method="post">
Your E-mail address: <input type="text" id="emails" placeholder="Enter your E-mail address"><br />
<input type="submit" value="提交">
</form>
PHP:
<?php
$file_emails = "emails.txt";
$line = 0;
$fp = fopen($file_emails , 'a+') or die("open file failure!");
if($fp)
{
while(stream_get_line($fp,8192,"\n"))
{
$line++;
}
fclose($fp);
}
$fp = fopen($file_emails , 'a+') or die("open file failure!");
$line++;
$string_emails = "Respondent "+$line+":"+$_POST["emails"]+"\r\n";
fwrite($fp,$string_emails);
fclose($fp);
?>