Support Forums
[SOLVED] HTML Form + PHP Help! - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21)
+---- Thread: [SOLVED] HTML Form + PHP Help! (/showthread.php?tid=17901)



[SOLVED] HTML Form + PHP Help! - J4P4NM4N - 04-10-2011

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.


RE: HTML Form + PHP Help! - J4P4NM4N - 04-11-2011

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