wieso PHP Parse error: syntax error, unexpected token ";" in /home/emmanuel/Downloads/hp.php on line 11?

2 Antworten

Mal von dem Fehler abgesehen, ist der Code ziemlich falsch. Du testest, ob mail, name und pass leer sind und arbeitest dann damit. So macht das ganze schon mehr Sinn:

if (!empty($_POST['mail']) && !empty($_POST['name']) && !empty($_POST['pass'])) { … }
Woher ich das weiß:Berufserfahrung – Entwickle Webseiten seit über 25 Jahren.
<link rel="stylesheet" href="style.css">
<?php
$db = unserialize(file_get_contents('data.php'));
if($db == false){
        $db = array();
}
if($_POST['mail'] == ''){
        if($_POST['name'] == ''){
                if($_POST['pass'] == ''){
                        if(!array_key_exists($_POST['mail'], $db)){
                                $db[$_POST['mail']] = [$_POST['name'], []];
                                file_put_contents('data.php', serialize($db));
                        } 
                }
        }
}
?>
<form action="" method="post">
    <center>
        <label for="firma_name" >name:</label><br>
        <input type="text" class="input" name="name" autocomplete="off"><br>
        <label for="produkte">email:</label><br>
        <input type="text"  class="input" name="mail" autocomplete="off"><br>
        <label for="adresse">pass:</label><br>
        <input type="text"  class="input" name="pass" autocomplete="off"><br>
        <input type="submit" class="anmelde_button" value="anmelden">
    </center>
</form>