Formulaire php

Fermé
veranok Messages postés 1 Date d'inscription lundi 8 novembre 2010 Statut Membre Dernière intervention 9 novembre 2010 - 9 nov. 2010 à 17:35
 Twinpics - 9 nov. 2010 à 18:22
Bonjour,
voici un formulaire
<head>
<title>GESTION EPROMS</title>
<link rel="stylesheet" type="text/css" href="feuilledestyle.css"/>



<htlm>

<title>GESTION EPROMS</title>
</head>
<body bgcolor=bgColor="red">
<br><br>
</font><font color="yellow">
<h1>
<marquee scrollamount="10" direction="right"><font size=5>FORMULAIRE DE SAISIE BRAVO</font></marquee>
</h1>
<hr size=3 noshade>
<center><h2><u>Inscription</u></h2><br/><br/>
<form action="traitement.php" method="post">
<p>
<table width="100%">
<tr><td>
<p align = "right">matricule: </p></td><td><input type ="integer" name="matricule" maxlength ="6"></td> </tr> <tr> <td>
<p align = "right">nom: </p></td><td><input type ="text" name="nom" maxlength ="15"></td> </tr> <tr> <td>
<p align = "right">prénom: </p> </td> <td> <input type ="text" name ="prenom" maxlength="20"></td> </tr> <tr> <td>
<p align = "right">contact: </p></td><td><input type ="integer" name="matricule" maxlength ="15"></td> </tr> <tr> <td>



</td></tr>
</table>
</br>
<input type = "reset" name = "annul" value = "annuler">
<input type= "submit" name= "Enregistrer"/>

</br>
</form>

</br>
</form>

<a href ="Accueil.html";> retour à l'accueil </a>


</center>
</body>
</html>
je souhaiterais créer un code php: traitement.php pour remplir ma base de données
<?
print('<br>');
include('includes/header.php');
if (isset($_POST['go'])){
$matricule = $_POST['matricule'];
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$contact = $_POST['contact'];
require('includes/start.php');
//cette page ouvre la base de donnée
$requete="INSERT bravo SET
matricule='$matricule',nom='$nom',prenom='$prenom',contact='$contact'";
$rsultat=mysql_query($requete);
$erreur=mysql_error();
print($erreur);
echo 'votre enregistrement a ete ajouté';
require ('includes/stop.php');
echo 'base de données fermée';
}
mais cela ne marche pa
aidez moi je dois rendre le projet dans deux jours
merci

1 réponse

Bonsoir,
Pour une requête d'insertion MySQL, la bonne syntaxe est:
INSERT INTO table (champ1, champ2, etc...) VALUES('donnee1', 'donnee2', etc...)

Allez bosse tes devoirs... Plus tard dans la vie active, personne ne fera ton travail à ta place :-)
------------------------------------------------------------------------------------------------------------------------------------------------
<* Suivez-moi sur FesseS-BouC *>
0