• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

php login page not working properly

i am unable to figure it out guys...

My login page doesn't work. i get ZERO output not even an error. so im begging for some help!! thanks in advance!!

Below is my login form and the php script.
<form method=post action=ehlogin.php>
<tr><td>Username:</td><td><input type=text name=username></td></tr>
<tr><td>Pass:</td><td><input type=password name=pass></td></tr>
<tr><td colspan=2 align=center><input type=submit value=Login></td></tr>
if( isset($_POST['Login']) && strval($_POST['Login'])=='Login' )
// connect to the mysql server 
$link = mysql_connect($server, $db_user, $db_pass) 
or die ("Could not connect to mysql because ".mysql_error()); 
// select the database
or die ("Could not select database because ".mysql_error()); 
$match = "select id from $table where username = '".$_POST['username']."' 
and password = '".$_POST['password']."';"; 
$qry = mysql_query($match) 
or die ("Could not match data because ".mysql_error()); 
$num_rows = mysql_num_rows($qry); 
if ($num_rows <= 0) { 
echo "Sorry, there is no username or password with: <strong>".$_POST['username']."</strong><br>"; 
echo "<a href=login.html>Try again</a>"; 
} else { 
setcookie("loggedin", "".$_POST['username']."", time()+(3600 * 24));
setcookie("username", "".$_POST['username']."", "TRUE");
echo "Welcome: <strong>".$_POST['username']."</strong><br>"; 
echo "Continue to the <a href=members.php>members</a> section."; 

Open in new window

  • 3
1 Solution
I just posted a login page here:

you should be able to make minor changes to suit your needs.
Ray PaseurCommented:
Let's work on the basics here.

Set error_reporting(E_ALL);

Use var_dump() to print out $_POST

See what the name of your submit button is.
Ray PaseurCommented:
Also, you might want to use phpinfo() and see if you are running in safe mode or something like that.
Ray PaseurCommented:
And if you're still looking for illumination, check this tutorial:

Best regards, ~Ray
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now