I'm new to Web programming it might be a silly doubt but still asking.
Edited my previous question.I have Register.html page and Welcome.php. In Register.html i have a form in which if username is not entered then call alert('Enter name'). Otherwise go to Welcome.php page print his username which he entered.
My problem is if i don't enter the username and still submit the form then the alert message doesn't pop up.
**This is my Register.html code**
<!DOCTYPE HTML>
<html>
<head>
<script>
function validation(){
if(document.getElementById('username').value=="")
{
alert('Enter name');
}
</script>
</head>
<body>
<h1>Enter the details</h1>
<form method="post" action="Welcome.php">
<table >
<tr>
<td>Username:</td>
<td><input type="text" name="username" id="username"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="pass" id="pass" ></td>
</tr>
<tr>
<td>Confirm Password:</td>
<td><input type="password" name="Repass" id="Repass" ></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="text" name="email" id="email"></td>
</tr>
<tr>
<td></td>
<td><input type="button" value="register" onclick="validation();"></td>
</tr>
</table>
</form>
</body>
</html>
**This is my Welcome.php**
<?php
echo "Welcome".$_POST['username'];
?>