Boarf, te casse pas. Facebook existe déjà.je suis en train de creer une base données pour le lycee
l19 : $adville_client=$_POST['adville_client']; vérifie dans ton formulaire si le name de ton champ est bien identique.l21 : $n°représentant=$_POST['n°représentant']; Le libellé n°représentant n'est valable ni pour un nom de variable, ni pour un champ de base.Code : Tout sélectionner
<html>
<head>
<title>Formulaire client- LA VIENNOISERIE DOREE</title>
</head>
<link rel="stylesheet" media="screen" type="text/css" title="css" href="client.css" />
<body>
<div id="tete">
<h1><center><b>LA VIENNOISERIE DOREE</b></center></h1>
</div>
<br />
<div id="corps">
<center><h2><b>FORMULAIRE DE SAISIE CLIENT</b></h2></center><br />
<form action="http://127.0.0.1/Viennoiserie/CLIENT.php" method="post" class="form">
<table>
<tr>
<td><li/><label><b>Numéro client</b></label></td><td><input type="text" name="n°client"></td>
</tr>
<tr>
<td><li/><label><b>Raison sociale</b></label></td><td><input type="text" name="raison sociale"></td>
</tr>
<tr>
<td><li/><label><b>Adresse client</b></label></td><td><input type="text" name="adrue client"></td>
</tr>
<tr>
<td><li/><label><b>Ville</b></label></td><td><input type="text" name="advilleclient"></td>
</tr>
<tr>
<td><li/><label><b>Catégorie client</b></label></td><td><input type="text" name="catégorie client"></td>
</tr>
<tr>
<td><li/><label><b>N° représentant</b></b></label></td><td><input type="text" name="n°représentant></td>
</tr>
<tr>
<td></td><td align="center"><input type="submit" value="Valider" ></td>
</tr>
</table>
</form>
<br />
<br />
</div>
</body>
</html>Code : Tout sélectionner
<html>
<head>
<title> Formulaire de saisie </title>
</head>
<link rel="stylesheet" media="screen" type="text/css" title="css" href="salarie.css" />
<body>
<div id="tete">
<h1><center><b></b></center></h1>
</div>
<br />
<div id="corps">
<center> <h2><b> FORMULAIRE DE SAISIE CLIENT </b></h2> </center> <br />
<center><b><?php
$n°client=$_POST['n°client'];
$raison sociale=$_POST['raison sociale'];
$adrue client=$_POST['adrue client'];
$advilleclient=$_POST['advilleclient'];
$Catégorie client=$_POST['Catégorie client'];
$n°représentantt=$_POST['n°représentant'];
$connexion=mysql_connect("localhost","root","mysql") or die ('Erreur de connection '.mysql_error());
if($connexion)
{
//connexion réussie
mysql_select_db("viennoiserie",$connexion) or die ('Erreur de connection '.mysql_error()) ;
$requete="INSERT INTO clientVALUES ('$n°client','$raison sociale','$adrue client','$advilleclient','$catégorie client','$n°représentant');";
$ok=mysql_query($requete,$connexion) ;
if($ok)
{
echo"Les informations ont été correctement ajoutées";
}
else
{
echo"Attention, l'ajout a échoué !";
}
}
else
{
echo"Problème à la connexion <br />";
}
mysql_close($connexion);
?></b> </center>
<br />
<br />
</div>
</body></html>
$Catégorie client=$_POST['Catégorie client'];
$n°représentantt=$_POST['n°représentant'];
Heureusement que j'ai dit :
Le libellé n°représentant n'est valable ni pour un nom de variable, ni pour un champ de base.
Mieux vaut choisir qq chose du style : num_representant (pas d'espaces, pas de °, pas de caractères accentués)
Warning: mysql_connect() [function.mysql-connect]: Accès refusé pour l'utilisateur: 'root'@'@localhost' (mot de passe: OUI) in C:\Program Files (x86)\EasyPHP-5.3.8.0\www\VIENNOISERIE\client.php on line 23
Erreur de connection Accès refusé pour l'utilisateur: 'root'@'@localhost' (mot de passe: OUI)
$connexion=mysql_connect("localhost","root","mysql") or die ('Erreur de connection '.mysql_error());
J'ai modifié la table avec les _ et pareil pour le formulaire et toujours ce message erreur (nouveau maintenant )$connexion=mysql_connect("localhost","root","mysql") or die ('Erreur de connection '.mysql_error()); par <?php
# Type="MYSQL"
# HTTP="true"
$hostname_localhost = "127.0.0.1";
$database_localhost = "le_nom_de_ta_base_de_donnees";
$username_localhost = "root";
$password_localhost = "";
$localhost = mysql_pconnect($hostname_localhost, $username_localhost, $password_localhost) or trigger_error(mysql_error(),E_USER_ERROR);
?>Notice: Undefined variable: connexion in C:\Program Files (x86)\EasyPHP-5.3.8.0\www\VIENNOISERIE\client.php on line 34
Problème à la connexion
Notice: Undefined variable: connexion in C:\Program Files (x86)\EasyPHP-5.3.8.0\www\VIENNOISERIE\client.php on line 54
Warning: mysql_close() expects parameter 1 to be resource, null given in C:\Program Files (x86)\EasyPHP-5.3.8.0\www\VIENNOISERIE\client.php on line 54
<html>
<head>
<title> Formulaire de saisie </title>
</head>
<link rel="stylesheet" media="screen" type="text/css" title="css" href="client.css" />
<body>
<div id="tete">
<h1><center><b></b></center></h1>
</div>
<br />
<div id="corps">
<center> <h2><b> FORMULAIRE DE SAISIE CLIENT </b></h2> </center> <br />
<center><b><?php
$num_client=$_POST['num_client'];
$raison_sociale=$_POST['raison_sociale'];
$adrue_client=$_POST['adrue_client'];
$advilleclient=$_POST['advilleclient'];
$categorie_client=$_POST['categorie_client'];
$num_representant=$_POST['num_representant'];
# Type="MYSQL"
# HTTP="true"
$hostname_localhost = "127.0.0.1";
$database_localhost = "viennoiserie";
$username_localhost = "root";
$password_localhost = "";
$localhost = mysql_pconnect($hostname_localhost, $username_localhost, $password_localhost) or trigger_error(mysql_error(),E_USER_ERROR);
//connexion réussie
$requete="INSERT INTO clientVALUES ('$num_client','$raison_sociale','$adrue_client','$advilleclient','$categorie_client','$num_representant');";
{
echo"Les informations ont été correctement ajoutées";
}
{
echo"Attention, l'ajout a échoué !";
}
{
echo"Problème à la connexion <br />";
}
?></b> </center>
<br />
<br />
</div>
</body></html>