I recently started learning html and I tried to make a short feedback form. That should send the data over to a php file and that should append it to a txt file. However, every time I try to submit my form data, I keep just seeing the PHP code. I have installed php.
<?php $name = $_post['username']; $email = $_post['pass']; $fp = fopen("formdata.txt", "a"); $savestring = $name . "," . $email . "n"; fwrite($fp, $savestring); fclose($fp); echo "<h1>You data has been saved in a text file!</h1>"; ?>
<html><body> <form name="userpassform" id="user_pass_form" action="formsaver.php" method="post"> Username<input type="text" name="username"/> <br /> Password<input type="password" name="pass"/> <br /> <input type="submit" value="Submit"/> <input type="reset"> </form> </body> </html>
I'm running everything locally from my computer. Help is appreciated =)