I am trying to check the variable for validation. I have written this code, but still 
I am not getting expected output. Can any of you suggest me what is missing in this ?
 
Expected Output ....
1)If the variable is set and value is not alphabatic then system should say 
"Alphabatic value require" for the field named "txtname'. And cursor should focus on 
txtname.
 
2)If the variable is set and value is not Numeric then system should say "Numeric 
value require" for the field named "txtph_no'. And cursor should focus on txtname. 
 


function check_validata()
 {
 if($_POST['txtname']=='')
 {
         if (!is_alpha($_POST['txtname']))
         {
          ?>
          <script>
           alert("Input alphabatic value !!!");
            online_form.txtname.focus();
          </script>
        <?
         }
         $txtname=$_POST['txtname'];
       ?>
    <script>
      alert("Input Name !!!");
      online_form.txtname.focus();
    </script>
     <?
 }
 else if($_POST['txtph_no']=='')
  {
        if (!is_numeric($_POST['txtph_no']))
         {
          ?>
          <script>
           alert("Input numeric value !!!");
            online_form.txtph_no.focus();
          </script>
        <?
        }

     ?>
    <script>
      alert("Input Phone No");
      online_form.txtph_no.focus();
    </script>
     <?
 }
}

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to