-2
我試圖寫出在我的.php中創建的錯誤,作爲我的.html中的警報,但我無法讓它運行。任何人都可以在我的php中找到語法misstake?
<?php if(isset($_SESSION["error"])){
echo "<script> alert(".$_SESSION["error"].");";
echo "</script>";}
?>
我thnk它只是一個misstake在語法,當我在網上PHP測試程序運行它,原因是其工作
PHP是在html的啓用和10日線後的工作:d
在這個例子中其工作:
<?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
}
?>
保留文件擴展名爲.php而不是.html – ManiMuthuPandi
這裏沒有sytax錯誤,但是如果你有一個* .html文件(除非你在你的web服務器中配置了這個文件),php代碼將不會被執行和執行。你也可以解釋你的2個文件是如何連接的?什麼叫什麼? aslo'alert(「。$ _ SESSION [」error「]。」)'會導致'alert(錯誤信息在這裏)',這會導致JS錯誤 – Auris
@Auris,應該測試過了,只是感到困惑,phpstorm錯誤了這一點,但酵母其worikng完全罰款:d的woirking代碼是\t \t \t \t \t警報('」 。$ _ SESSION [「error」]。「');」; \t \t \t \t \t \t \t unset($ _ SESSION [「error」]); \t \t}?> –
memporer