I'm using a PHP form as part of my website for people to get in touch. The form will post the results to another webpage. At the moment, for testing it is just plain but it will be password protected. It doesn't have to be secure however, this isn't a commercial thing, just a project. Form code:
<form action="contactform.php" method="post">
<p><label>Name: <input name="name" placeholder="eg: John Doe"></label></p>
<p><label>Subject: <input name="subject" required placeholder="eg: App Updates?"></label></p>
<p><label>Content: <input name="content" required placeholder="eg: When will the next update to your app be released?"></label></p>
<p><label>Email Address: <input name="email" required placeholder="eg: withheld@xxxx.com" type="email"></label></p>
<p><button input type="submit">Submit form</button></p>
</form>
PHP code:
<?php
$name = htmlspecialchars($_POST['name']);
$email = htmlspecialchars($_POST['email']);
$subject = htmlspecialchars($_POST['subject']);
$content = htmlspecialchars($_POST['content']);
echo $name, $email, $subject, $content;
$text = "NAME: $name <br>
EMAIL: $email<br>
SUBJECT: $subject<br>
CONTENT: $content<br><br><br>";
$file = fopen("formresults.html","a+");
fwrite($file, $text);
fclose($file);
?>
I don't know why it isn't just posting, whenever I test it in my browser it just downloads the PHP page