0
if(isset($_POST['check'])){
    $email =  $_POST['email'];
    if (filter_var($email, FILTER_VALIDATE_EMAIL)) { 
       echo '<script language="javascript">'; 
       echo 'alert(Valid email)';   
       echo '</script>';
    } else { 
       echo '<script language="javascript">'; 
       echo 'alert(Not valid email)';   
       echo '</script>';     
    }
}

i'm trying to show an alert with the result but it's not working. however echo a text working but not JS alert.

why is that? is there another way to do that?

brombeer
  • 8,716
  • 5
  • 21
  • 27
tetro
  • 15
  • 3

1 Answers1

1

put '<script type="application/javascript">' instead of '<script language="javascript">'

yout script tag attribute is wrong and also you use alert function wrong. change alert(Valid email) to alert("Valid email") and change alert(Not valid email) to alert("Not valid email").

Berk Kanburlar
  • 260
  • 2
  • 11