anyone can find the syntax misstake in my php?

memporer

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
                    }
                ?>
J P

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.

edited at
0

Comments

0 comments
Login to comment

Related

Can anyone help me to find a error in PHP?

Syntax: const {} = variableName, can anyone explain or point me into the right direction

can anyone tell me how this syntax is called and what it does?

Can anyone explain this enumerator syntax?

Can anyone see the flaw in my code?

Can anyone tell me why this occur MySQL syntax error?

Can anyone generate mongodb query for my scenario

Can anyone tell why my algorithm is wrong?

can anyone pinpoint the error in my recursive function?

Can you find my error in this simple Excel VBA syntax?

can anyone explain this syntax? char *seats[14][7];

Can anyone help me to optimize my query?

PHP: can anyone explain this Exception Handler error?

Can anyone explain the length parameter to fgets() in PHP?

can anyone find out why is the tree not linking

Can anyone please explain this python syntax - reverse word

add two custom sprites into a scene,why do these sprites' methods will effect each other,anyone can find the mistake in my code? thanks

I dont't understand why im getting syntax error on my code below. Can anyone help me?

Can anyone help me with my currency shop?

SQL Can anyone find an error in my query?

Can anyone help me find out what's wrong with my form validation code?

Can anyone help me find what is wrong with my code?

I am a beginner in web scraping Can anyone help me to find where in my problem?

How can I fix this syntax error on my PHP MySQL query

Can anyone notice where the mistakes is in my code?

Can not find the Syntax 1064 Error in my store procedure using MySQL

can anyone help me to turn this to js syntax?

Can anyone help me find out whats wrong with my code? something isnt right but python says its fine

Can anyone find the error in this MySQL code? (beginner)