par
Enzord » 01 mars 2021, 16:37
<?php
$bdd = mysqli_connect('127.0.0.1','root','','sitemarchand');
$nomPersonne = $_POST['nomPersonne'];
$prenomPersonne = $_POST['prenomPersonne'];
$mailPersonne = $_POST['mailPersonne'];
$mdpPersonne = $_POST['mdpPersonne'];
// Vérification de la connexion
if ($bdd) {
echo "Connexion réussie";
}
else {
echo("Échec de la connexion : " . mysqli_connect_error());
}
echo '<br>';
// Insertion dans la base de données
$requete = "INSERT INTO inscription VALUES ('$nomPersonne','$prenomPersonne','$mailPersonne','$mdpPersonne')";
if (mysqli_query($bdd, $requete)) {
echo "Vous êtes maintenant inscrit";
}
else {
echo "<br>" . "Erreur: " . $requete . "<br>" . mysqli_error($bdd);
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inscription</title>
<link rel="stylesheet" href="../css/Accueil.css">
<link rel="stylesheet" href="../css/Inscription.css">
<!-- Lien pour les polices d'écriture -->
<link href="https://fonts.googleapis.com/css2?family=Potta+One&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Raleway:wght@500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Questrial&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css">
</head>
<body>
<!-- Barre de navigation -->
<header id="header" role="banner" class="main-header">
<div class="header-inner">
<div class="header-logo">
<img src="../../Photos/logo.png" alt="Notre Logo" width="120">
</div>
<div class="header-nav">
<a href="../HTML/Accueil.html" class="header-nav a"><i class="fas fa-home"></i> ACCUEIL </a>
<a href="../HTML/PasserelleProduit.html" class="header-nav a"><i class="fas fa-cart-arrow-down"></i> PRODUIT </a>
<a href="../HTML/Inscription.html" class="header-nav a"><i class="fas fa-user-circle"></i> COMPTE </a>
<a href="../HTML/A_Propos.html" class="header-nav a"><i class="fas fa-envelope"></i> A PROPOS </a>
</div>
</div>
</header>
<!-- Formulaire de connexion -->
<div class="login-box">
<h2 class="">INSCRIPTION</h2>
<form method="POST" action="../PHP/Inscription.php">
<div class="user-box">
<input type="text" name="nomPersonne" required="">
<label>Nom</label>
</div>
<div class="user-box">
<input type="text" name="prenomPersonne" required="">
<label>Prénom</label>
</div>
<div class="user-box">
<input type="text" name="mailPersonne" required="">
<label>Mail</label>
</div>
<div class="user-box">
<input type="password" name="mdpPersonne" required="">
<label>Mot de Passe</label>
</div>
<div class="connexion">
<a href="../HTML/Connexion.html">
Déja inscrit, Cliquez ici pour vous connecter.
</a>
</div>
<div class = "insertion">
<a href="../PHP/Inscription.php">
<span></span>
<span></span>
<span></span>
<span></span>
Valider
</a>
</div>
</form>
</div>
</body>
</html>
Voici les messages d'erreur qui apparaissent :
( ! ) Notice: Undefined index: nomPersonne in C:\wamp\www\Sites\Site Marchand\Code\PHP\Inscription.php on line 4
( ! ) Notice: Undefined index: prenomPersonne in C:\wamp\www\Sites\Site Marchand\Code\PHP\Inscription.php on line 5
( ! ) Notice: Undefined index: mailPersonne in C:\wamp\www\Sites\Site Marchand\Code\PHP\Inscription.php on line 6
( ! ) Notice: Undefined index: mdpPersonne in C:\wamp\www\Sites\Site Marchand\Code\PHP\Inscription.php on line 7
Merci d'avance pour votre aide !