I'm trying to write out the errors, which are created in my .php , as an alert in my .html but i cant get it to run.
<?php if(isset($_SESSION["error"])){
echo "<script> alert(".$_SESSION["error"].");";
echo "</script>";}
?>
i thnk its just a misstake in the syntax, becuase when i run it in an online php testing program it works
php is enabled in .html and its working 10 lines later :D
in this example its working:
<?php if(!isset($_SESSION["login_user"])){
echo "<fieldset> <form id='login' method='post' action='../php/login.php'>";
echo "<input type='text' name='email' placeholder='E-Mail Adresse' required>";
echo "<input type='password' name='passwort' placeholder='Passwort' required><br/>";
echo "<a href='registrierung.html'>Registrieren</a>";
echo " <input name='submit' id='anmelden' type='submit' value='Login'>";
echo " </form>";
echo "</fieldset>";
}
else{
//Hier Html für eingeloggt Kasten Bitte
}
?>
Never done such an error handling. But if you want to alert a String in JavaScript ist has to be in quotes. So I think it has to be: echo " alert(' ".$_SESSION["error"]." '); ";
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments