php login page not working properly

Posted on 2008-11-10
Last Modified: 2012-05-05
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

Question by:Catcherman16
    LVL 82

    Expert Comment

    I just posted a login page here:

    you should be able to make minor changes to suit your needs.
    LVL 107

    Expert Comment

    by:Ray Paseur
    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.
    LVL 107

    Expert Comment

    by:Ray Paseur
    Also, you might want to use phpinfo() and see if you are running in safe mode or something like that.
    LVL 107

    Accepted Solution

    And if you're still looking for illumination, check this tutorial:

    Best regards, ~Ray

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now