Hi,
I made a login form on my site but I am new to javascript and do not know how this could be done (See title).
I am trying to make an alert start if one of the login forms are left empty. Any advice is greatly appreciated, thanks in advance!
Ex:
<html>
<head>
<title>Login</title>
<script type="text/javascript">
function show_alert(){
alert("Please make sure all fields are entered!");
}
</script>
</head>
<body>
<?php
echo " <form action='' method='POST'>
Username: <input type='username' name='username'>
Password: <input type='password' name='password'>
<input type='submit' value='Login'>
</form>";
if ($_POST){
$username = mysql_escape_string($_POST['username']);
$password = mysql_escape_string($_POST['password']);
if ($username&&$password){
//Standard login script...
} else {
//How do I start the javascript if this is true????
}
}
?>
</body>
</html>