Simple login problem

hi all,
i have created one simple login form to verify only username and password.i have created username as admin and password as admin123 in phpmyadmin database.
now if only both the username and password matches then it should display success message.
but for me after giving username name as admin and password as admin123 it is asking for “whether to save or download the file” instead of displaying the message as “login is successfull”.why it is asking that one.whats woron in my code…
below is my code…
login.html


<form name="form1" method="post" action="checklogin.php">
<strong>Member Login </strong>
</br>
Username: <input name="myusername" type="text" id="myusername" />
</br>
Password: <input name="mypassword" type="password" id="mypassword" />
</br>
<input type="submit" name="Submit" value="Login" />
</form>

it is checklogin.php


<?php
// Connect to server and select databse.
mysql_connect("localhost", "root", "")or die("cannot connect"); 
mysql_select_db("test")or die("cannot select DB");

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

// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);

$sql="SELECT * FROM users WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1)
{
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword"); 
header("location:login_success.php");
}
else 
{
echo "Wrong Username or Password";
}
?>

it is login_success.php


<? 
session_start();
if(!session_is_registered(myusername)){
header("location:main_login.php");
}
?>
<html>
<body>
Login Successful
</body>
</html>

tell me what went wrong

Hy,
I’m not sure if this is the cause, but try us <?php instead of <? in “login_success.php”

Is it asking if you want to download checklogin.php or loginsuccess.php?

If it is asking to download loginsuccess.php, then I would suggest doing what MarPlo had said, changing the <? to <?php, as most (if not all) versions of php do not like <? and prefer the full starting tag, however I believe this can be changed within the php.ini.

If it is asking to download checklogin.php this can be a configuration problem with your webserver. But considering you are able to use phpmyadmin, this doesn’t seem to be the problem.