Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] HTML Form + PHP Help!
#1
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.
Reply
#2
Fixed it. Had no webserver running. Plus switched my server-side processing to Perl (but that's irrelevant to this thread).
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PHP Framework List: An Ultimate Guide to 102 PHP Frameworks for Web Developers tk-hassan 0 943 07-27-2020, 11:26 PM
Last Post: tk-hassan
  PHP email input form - having trouble getting the form to work... abayindi 4 2,736 03-19-2012, 10:02 AM
Last Post: RainbowDashFTW
  [NEED HELP] PHP Form post, get, echo Đενɨаηсε™ 5 2,077 02-06-2012, 01:16 PM
Last Post: ★Cooldude★
  How to make a form. HB Virus 10 3,639 12-30-2011, 08:03 PM
Last Post: BreShiE
  PHP Video Tutorials (PHP For Beginners) Eleqtriq 4 3,671 10-10-2011, 01:00 PM
Last Post: Greyersting

Forum Jump:


Users browsing this thread: 1 Guest(s)