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.
<table>	  
<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>
</form>
</table>
 
 
<?php
 
if( isset($_POST['Login']) && strval($_POST['Login'])=='Login' )
{
 
 
include("config.php"); 
 
 
 
// 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
mysql_select_db($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>"; 
exit;
 
} 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

LVL 1
Catcherman16Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
I just posted a login page here:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23892100.html

you should be able to make minor changes to suit your needs.
0
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.
0
Ray PaseurCommented:
Also, you might want to use phpinfo() and see if you are running in safe mode or something like that.
0
Ray PaseurCommented:
And if you're still looking for illumination, check this tutorial:
http://www.sitepoint.com/article/users-php-sessions-mysql/

Best regards, ~Ray
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.