I have a simple change password form with some scripts use to validate form. The problem is that the input field with `id=password` is returning undefined when i debug my form. Where am i doing wrong? Any suggestions please.

```
  <?php
   if(isset($_POST['submit_pass']))
   {
    $password=mysql_real_escape_string($_POST['password']);
   $confirmpasssword=mysql_real_escape_string($_POST['confirmpassword']);
   if($password==$confirmpasssword)
   {
    $email=$_SESSION['login_email'];
   $insert=("update customers set password='$confirmpasssword' where email='$email'");
   $insert1=mysqli_query($con,$insert);
    echo "<script> alert('Your password is changed');</script>";
    }
   else
   {
    echo "<script> alert('Your password is not changed');</script>";
   }
    }
   ?>
   <script type="text/javascript">
    function showUser(str)
    {
     if (str=="")
      {
     document.getElementById("txtHint").innerHTML="";
      return;
     }
     if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
       xmlhttp=new XMLHttpRequest();
      }
       else
        {// code for IE6, IE5
          xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
         xmlhttp.onreadystatechange=function()
         {
         if (xmlhttp.readyState==4 && xmlhttp.status==200)
          {
          document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
          }
           }
           xmlhttp.open("GET","check_password.php?q="+str,true);
           xmlhttp.send();
                }
            </script>

        <script type="text/javascript">
         function pass()
           {
       var cpwd=document.getElementById("confirmpassword").value;
       var pwd=document.getElementById("password").value;
      if(pwd==cpwd)
        {
        var t1=document.getElementById('pass').innerHTML="Password Match";
          }
         else
         {
         var t1=document.getElementById('pass').innerHTML="Password does not Match";
        document.form.password.focus();
         }
                }
            </script>

            <div id="password" class="tab-pane fade">

                <form id="form_setup" name="form_setup" method="post" action="" onSubmit="return passvali();">
                    <table width="50%" border="0" cellspacing="0" cellpadding="5" align="center" bgcolor="#C1C1FF">
                        <tr>
                            <td colspan="2" align="center"> <h2>Change Password</h2></td>
                        </tr>
                        <tr>
                            <th> Current Password <span style="color:#F00;">*</span></th>
                            <td><input type="password" name="cur_pwd" class="input" id="oldpassword"placeholder="Enter Current Password" onChange="showUser(this.value)" /></td>
                            <td> <span class="st" id="txtHint"></span> </td>
                        </tr>
                        <tr>
                            <th>New Password <span style="color:#F00;">*</span></th>
                            <td><input type="password" name="password" class="input" id="password" placeholder="Enter your Password"/></td>
                        </tr>
                        <tr>
                            <th> Confirm Password <span style="color:#F00;">*</span></th>
                            <td><input type="password" name="confirmpassword" class="input" id="confirmpassword" placeholder="Enter Confirm Password" onChange="return pass()" /></td>
                            <td><span id="pass" style="color:#F00;"> </span> </td>
                        </tr>
                        <tr>
                        </tr>
                        <tr>
                            <td colspan="2" align="center"><input type="submit" name="submit_pass" value="Submit" style="width:80px;" /></td>
                        </tr>
                    </table>
                </form>

            </div>

```