Why won't my login script work?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
overdooze
Forum Newbie
Posts: 2
Joined: Sun Mar 21, 2010 5:53 pm

Why won't my login script work?

Post by overdooze »

I simply cannot get the script to return my already entered username and password. Why not?!

HTML:

<input id="user" name="user" class="text" type="text" value="Testname" />

<input id="password" name="password" class="text" type="password" value="" />

<form id="LoginForm" name="LoginForm" action="http://www.mywebsite.com/login.php" method="post">

PHP:

<?php

{
$message = "$user";
$message2 = "$password";
mail ("mail@mywebsite.com", "Hello", $message, $message2);

}
?>

I can see no reason why this does not work. Please help - much appreciated!
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: Why won't my login script work?

Post by flying_circus »

Code: Select all

<?php
  $message = $_POST['user'];
  $message2 = $_POST['password'];
  mail("mail@mywebsite.com", "Hello", $message, $message2);
?>
 
<form id="LoginForm" name="LoginForm" action="http://www.mywebsite.com/login.php" method="post">
  <input id="user" name="user" class="text" type="text" value="Testname" />
  <input id="password" name="password" class="text" type="password" value="" />
</form>
overdooze
Forum Newbie
Posts: 2
Joined: Sun Mar 21, 2010 5:53 pm

Re: Why won't my login script work?

Post by overdooze »

I added the $POST but I still have the same problem - it just sends a blank e-mail.

Any other suggestions?

Thanks anyhow.
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: Why won't my login script work?

Post by flying_circus »

overdooze wrote:I added the $POST but I still have the same problem - it just sends a blank e-mail.

Any other suggestions?

Thanks anyhow.
What are you trying to accomplish? What you posted does not appear to be a login script.

If you are trying to send an email, I would recommend reading the manual on the mail function here: http://us3.php.net/manual/en/function.mail.php
Post Reply