It is the function deserialiser that has problems. I checked semicolons and braces in this function. I also checked the questions posed and their answers but none seemed helped. thank you for helping me with this.
PHP Parse error: syntax error, unexpected 'echo' (T_ECHO) in /usercode/file.php on line 55
<!DOCTYPE html>
<html>
<head>
<title>Forum ASI</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<header id="top">
<h1>Forum ASI</h1>
</header>
<p id="probleme"></p>
<form name="formulaire" action="post_message.php" method="post" enctype="text/plain">
<fieldset>
<legend>Coordonnées :</legend>
<label for="name">Nom : </label><input placeholder="Saisissez votre nom" id="name" name="name" type="text" size= "30" />
<label for="email">E-mail : </label><input placeholder="Saisissez votre email" id="email" name="email" type="text" size= "30" />
</fieldset>
<fieldset>
<legend>Message :</legend>
<textarea rows= "4" cols= "50" id="message" name="message"></textarea>
</fieldset>
<input type="submit" value="Poster le message" />
<input type="reset" value="Effacer" />
</form>
<?php
class Message {
private $date;
private $nom;
private $email;
private $mess;
public function __construct($nom, $email, $mess){
$this->date = date('m/d/Y h-i-s a', time());
$this->nom = $nom;
$this->email = $email;
$this->mess = $mess;
}
public function serializer($nomFic){
$fichier = fopen($nomFic, "a+");
fputs($fichier,$this->date.": ".$this->nom.": ".$this->email.": ".$this->mess."\n");
fclose($fichier);
}
}
function deserialiser($nomFic){
$fichier = fopen($nomFic, "r+");
while(!feof($fichier)){
$ligne = fgets($fichier);
if(!empty($ligne)) {
$tab = explode(':', $ligne,4);
echo "<fieldset class='contour'><legend class='leg'>".$tab[0]." ".$tab[1]." ".$tab[2]."</legend><p>".$tab[3]."</p></fieldset>";
}
}
fclose($fichier);
}
?>
<?php
if (isset($_POST) && !empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['message'])){
$message1=new Message($_POST['name'],$_POST['email'],$_POST['message'] );
$message1->serializer("messages.txt");
deserialiser("messages.txt");
}
?>
<footer>
</footer>
</body>
</html>