title: Registration Page,validation and send data to php file
body: <p>I'm new to Web programming it might be a silly doubt but still asking.</p>
  
  <p>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.</p>
  
  <p>My problem is if i don't enter the username and still submit the form then the alert message doesn't pop up. </p>
  
  <pre><code>**This is my Register.html code** 
  &lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script&gt;
  function validation(){
  
  if(document.getElementById('username').value=="")
  {
      alert('Enter name');
  }
  
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;h1&gt;Enter the details&lt;/h1&gt;
  &lt;form method="post" action="Welcome.php"&gt;
  &lt;table &gt;
  &lt;tr&gt;
      &lt;td&gt;Username:&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" name="username" id="username"&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Password:&lt;/td&gt;
  &lt;td&gt;&lt;input type="password" name="pass" id="pass" &gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Confirm Password:&lt;/td&gt;
  &lt;td&gt;&lt;input type="password" name="Repass" id="Repass" &gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Email:&lt;/td&gt;
  &lt;td&gt;&lt;input type="text" name="email" id="email"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="button" value="register" onclick="validation();"&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  
  
  
  **This is my Welcome.php**
  &lt;?php
  echo "Welcome".$_POST['username'];
  ?&gt;
  </code></pre>