Unexpected T_IF
Benjamin
-
Pitet Messages postés 2845 Statut Membre -
Pitet Messages postés 2845 Statut Membre -
Bonjour, j'ai un problème avec mon codage j'ai une erreur qui s'intitule Parse error: syntax error, unexpected T_IF in C:\Program Files (x86)\Ampps\www\Site\formulaire.php on line 7
Merci d'avance pour votre aide :D
Mon code est le suivant:
<?php
$bdd = new PDO('mysql:host=127.0.0.1;dbname=espace_membre', 'root ,');
if(isset($_POST['forminscription']))
{
echo "Vous étes bien inscrits merci !!"
}
else
{
$erreur = "Tout les champs doivent etre completer!!"
}
if(!empty(($_POST[pseudo]) AND) if(!empty(($_POST[mail]) AND if(!empty(($_POST[mail2]) AND if(!empty(($_POST[mdp]) AND if(!empty(($_POST[mdp2]) AND
$pseudo = htmlspecialchars($_POST['pseudo']);
$mail = htmlspecialchars($_POST['mail']);
$mail2 = htmlspecialchars($_POST['mail2']);
$mdp = sha1($_POST['mdp']);
$mdp2 = sha1($_POST['mdp2']);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/styles.css"/>
<title>iReYaX- Forum </title>
</head>
<body>
<div align="center">
<h2>Inscription</h2>
<br /><br />
<form method="post" action="">
<table>
<tr>
<td align="right">
<label for="pseudo">Pseudo :</label>
</td>
<td>
<input type="text" placeholder="Votre pseudo" id="pseudo" name="pseudo"/>
</form>
</td>
</tr>
<tr>
<td align="right">
<label for="mail">E-mail :</label>
</td>
<td>
<input type="email" placeholder="Votre e-mail" id="mail" name="mail"/>
</form>
</td>
</tr>
<tr>
<td align="right">
<label for="mail2">Confirmer l'e-mail :</label>
</td>
<td>
<input type="email" placeholder="Confirmer votre e-mail" id="mail2" name="mail2"/>
</form>
</td>
</tr>
<tr>
<td align="right">
<label for="mdp">Votre Mot De Passe :</label>
</td>
<td>
<input type="password" placeholder="Votre Mot De Passe" name="mdp"/>
</form>
</td>
</tr>
<tr>
<td align="right">
<label for="mdp2">Confirmer le mot de passe :</label>
</td>
<td>
<input type="password" placeholder="Confirmer votre mot de passe" id="mdp2" name="mdp2"/>
</form>
<?php if(isset($erreur))
{
echo $erreur;
}
?>
</td>
</tr>
<tr>
<td></td>
<td>
<br/>
<input type="submit" name="forminscription" value="Je m'inscris" />
</td>
</table>
</tr>
</div>
</html>
</body>
Merci d'avance pour votre aide :D
Mon code est le suivant:
<?php
$bdd = new PDO('mysql:host=127.0.0.1;dbname=espace_membre', 'root ,');
if(isset($_POST['forminscription']))
{
echo "Vous étes bien inscrits merci !!"
}
else
{
$erreur = "Tout les champs doivent etre completer!!"
}
if(!empty(($_POST[pseudo]) AND) if(!empty(($_POST[mail]) AND if(!empty(($_POST[mail2]) AND if(!empty(($_POST[mdp]) AND if(!empty(($_POST[mdp2]) AND
$pseudo = htmlspecialchars($_POST['pseudo']);
$mail = htmlspecialchars($_POST['mail']);
$mail2 = htmlspecialchars($_POST['mail2']);
$mdp = sha1($_POST['mdp']);
$mdp2 = sha1($_POST['mdp2']);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/styles.css"/>
<title>iReYaX- Forum </title>
</head>
<body>
<div align="center">
<h2>Inscription</h2>
<br /><br />
<form method="post" action="">
<table>
<tr>
<td align="right">
<label for="pseudo">Pseudo :</label>
</td>
<td>
<input type="text" placeholder="Votre pseudo" id="pseudo" name="pseudo"/>
</form>
</td>
</tr>
<tr>
<td align="right">
<label for="mail">E-mail :</label>
</td>
<td>
<input type="email" placeholder="Votre e-mail" id="mail" name="mail"/>
</form>
</td>
</tr>
<tr>
<td align="right">
<label for="mail2">Confirmer l'e-mail :</label>
</td>
<td>
<input type="email" placeholder="Confirmer votre e-mail" id="mail2" name="mail2"/>
</form>
</td>
</tr>
<tr>
<td align="right">
<label for="mdp">Votre Mot De Passe :</label>
</td>
<td>
<input type="password" placeholder="Votre Mot De Passe" name="mdp"/>
</form>
</td>
</tr>
<tr>
<td align="right">
<label for="mdp2">Confirmer le mot de passe :</label>
</td>
<td>
<input type="password" placeholder="Confirmer votre mot de passe" id="mdp2" name="mdp2"/>
</form>
<?php if(isset($erreur))
{
echo $erreur;
}
?>
</td>
</tr>
<tr>
<td></td>
<td>
<br/>
<input type="submit" name="forminscription" value="Je m'inscris" />
</td>
</table>
</tr>
</div>
</html>
</body>
2 réponses
Salut,
Tu n'as pas besoin de répéter If quand tu veux tester plusieurs conditions en même. And suffit.
Tu n'as pas besoin de répéter If quand tu veux tester plusieurs conditions en même. And suffit.
if(!empty($_POST[pseudo]) and !empty($_POST[mail]) and !empty($_POST[mail2]) and !empty($_POST[mdp]) and !empty($_POST[mdp2]))
Benjamin
jai essayer ca ne change rien
Benjamin
mais je suis daccord jai quand meme fais une erreur