javascript - Echo after header -


this part of code. code moving location, echo below not working. sure header affecting somehow

else {      header('location: index.php');       echo '<script>            document.getelementbyid("nick").value = "invalid email";                                                                                      document.getelementbyid("nick").classname = "invalidemail";             </script>'; 

if read header in php functions, came know nothing gets printed after header giving instructions redirect on index.php

however achieve same, can use session variables.

so, on page redirecting index.php:

$_session['error']=true; header('location: index.php');  

on index.php, check if session variable true:

if($_session['error']== true) {       echo '<script type="text/javascript">              document.getelementbyid("nick").value = "invalid email";                                                                                        document.getelementbyid("nick").classname = "invalidemail";             </script>'; } 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -