Bonjour à tous!
J'essaie de créer un livre d'or sur mon site mais je encontre quelques difficultées.
Donc tout d'abord j'ai crée une table:
CREATE TABLE `livredor`.`livredor` (
`Nom` INT NOT NULL ,
`Genre` INT NOT NULL ,
`Satisfaction` INT NOT NULL ,
`Commentaires` INT NOT NULL
) ENGINE = MYISAM ;
Ensuite Traitement.php
<html>
<head>
<title> Traitement.php</title>
</head>
<body>
<?php
mysql_connect('localhost','root','');
mysql_select_db('livredor');
$maRequete="insert into livredor values('$v1','$v2','$v3',$v4')";
mysql_query($maRequete);
$v1=$_POST['Nom'];
$v2=$_POST['Genre'];
$v3=$_POST['Satisfaction'];
$v4=$_POST['Commentaires'];
echo "valeurs : $v1 $v2 $v3 $v4";
?>
</body>
</html>
Et enfin livredor.php pour afficher le formulaire :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Livre d'or</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
form, .pages
{
text-align:center;
}
</style>
</head>
<B>
<a href= "http://localhost/MonSiteWeb/Page%20accueil.php"> <font color="#CC0033" size=3 face="Calisto MT"> ← Retour à la page d'accueil </font> </a>
                                             
                                             
             
<font color="#660066" size=6 face="Calisto MT">
Votre avis sur le site
                             
</hr>
</font>
</B>
<br> <br> <br> <br>
<body BGCOLOR="#DFF1A5">
<font face="Calisto MT">
<form name="Traitement.php"
method="POST"
action="Traitement.php">
Nom <input type="text" name="Nom" value=""/>
<br> <br>
Genre <input type="radio" name="Genre" value="M"/> M
<input type="radio" name="Genre" value="F"/> F
<br> <br>
Votre avis sur le site
<select name="Satisfaction">
<option value="1">Pas du tout satisfait </option>
<option value="2"> Juste satisfait </option>
<option value="3"> Satisfait </option>
<option value="4"> Très satisfait </option>
</select>
<br> <br>
Mettez ici vos commentaires <br>
<textarea name="Commentaires" rows="10" cols="50">
</textarea>
<br> <br>
<input type="submit" value="envoyer"/>
</form>
</font>
</body>
</html>
Mon formulaire s'affiche correctement mais quand j'envoie j'obtiens ces erreurs :
Notice: Undefined variable: v1 in C:\wamp\www\MonSiteWeb\Traitement.php on line 10
Notice: Undefined variable: v2 in C:\wamp\www\MonSiteWeb\Traitement.php on line 10
Notice: Undefined variable: v3 in C:\wamp\www\MonSiteWeb\Traitement.php on line 10
Notice: Undefined variable: v4 in C:\wamp\www\MonSiteWeb\Traitement.php on line 10
valeurs : dupond F 3 site intéressant
Voilà j'ai du faire des erreurs, si quelqu'un pourrait m'aider ca serait super !
Merci!
Partager