Jump to content

Form Post not sending info to Action Page


Guber-X

Recommended Posts

I really don't know whats going on... I have other smaller forms on my site that send POST info to the Action page and work. but this on is not...

 

This form is just a User Login form. my registration form works perfectly, just the login fails...

 

all i get from this is of course just empty user name and password $_POST... its not sending the info after submit

 

Form Code:

<form method="post" name="userlogin" action="checklogin.php">
<table>
<tr>
<td>
 User Name:
</td>
<td>
 <input type="text" id="user_name" size="25">
</td>
</tr>
<tr>
<td>
 Password:
</td>
<td>
 <input type="password" id="password" size="25">
</td>
</tr>
<tr>
<td>
 <input type="submit" name="Submit" value="Login">
</td>
</tr>
</table>
</form>

 

checklogin.php code:

<?php
ob_start();

// username and password sent from form
$user_name = $_POST['user_name'];
$password = $_POST['password'];

if(empty($user_name)){
$user_name = 'Empty User Name';
echo $user_name;
die;
}
if(empty($password)){
$password = 'Empty Password';
echo $password;
die;
}

$securepassword = md5($password);
include('connect.php');
$sql = "SELECT * FROM member WHERE user_name='$user_name' and password='$password'";
$result = mysql_query($sql)
or die('Query Failed: '.mysql_error());

// Mysql_num_row is counting table row
$count = mysql_num_rows($result);

// If result matched $user_name and $password, table row must be 1 row
if($count==1){

// Register $user_name, $password and redirect to file "login_success.php"
session_register("user_name");
session_register("password");
header("location:index.php");
}
else {
echo "Wrong Username or Password<br>";
echo $user_name.'<br>'.$password.'<br>'.$securepassword;
}
ob_end_flush();
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.