Php enregistrement mySql

Fermé
Utilisateur anonyme - Modifié par Alien41 le 18/04/2010 à 23:59
kij_82 Messages postés 4088 Date d'inscription jeudi 7 avril 2005 Statut Contributeur Dernière intervention 30 septembre 2013 - 19 avril 2010 à 11:26
Bonsoir, j'essaye à tout pris de faire un enregistrement dans une BDD Mysql.

Voici le code PHP :

<?php 

if (isset($_POST['pseudo']) and ($_POST['passe']) and ($_POST['prenom']) and ($_POST['nom']) and ($_POST['email']) and ($_POST['location'])) 
{ 
try 
{ 
 $bdd = new PDO('mysql:host=localhost;bdname=test', 'root', ''); 
} 
catch(Exeption $e) 
{ 
 die('Erreur :' .$e->getmessage()); 
} 

$req = $bdd->prepare('INSERT INTO membre(pseudo, passe, prenom, nom, email) VALUES (:$_POST[\'pseudo\'],$_POST[\'passe\'],$_POST[\'prenom\'],$_POST[\'nom\'],$_POST[\'email\']'); 
$req->execute(array('pseudo' => $_POST['pseudo'],'passe' => $_POST['passe'],'prenom' => $_POST['prenom'],'nom' => $_POST['nom'],'passe' => $_POST['email'])); 
echo"Merci, vous êtes maintenant inscrit(e) sur Reseau41 !"; 

} 

?> 



Le Formulaire (dans la même page) :

<form action="" method="POST"> 
<table width="100%" height="%" cellpadding="0" cellspacing="0" align="center" border="0"> 
<tr> 
<td><img src="icones/38.png" width="14" height="14"></td><td><b>Pseudo :</b></td><td align="right"><input type="text" name="pseudo" style="background-color:#eef5fc; width:315;"></td></tr> 
<tr> 
<td><img src="icones/56.png" width="14" height="14"></td><td><b>Mot de Passe :</b></td><td align="right"><input type="password" name="passe" style="background-color:#eef5fc; width:315;"></td></tr> 
<tr> 
<td><img src="icones/37.png" width="14" height="14"></td><td><b>Prenom :</b></td><td align="right"><input type="text" name="prenom" style="background-color:#eef5fc; width:315;"></td></tr> 
<tr> 
<td><img src="icones/37.png" width="14" height="14"></td><td><b>Nom :</b></td><td align="right"><input type="text" name="nom" style="background-color:#eef5fc; width:315;"></td></tr> 
<tr> 
<td><img src="icones/47.png" width="14" height="14"></td><td><b>E-mail :</b></td><td align="right"><input type="text" name="email" style="background-color:#eef5fc; width:315;"></td></tr> 
<tr> 
<td><img src="icones/61.png" width="14" height="14"></td><td><b>Location :</b></td><td align="right"><input type="text" name="location" style="background-color:#eef5fc; width:315;"></td></tr> 
<td></td><td></td><td align="right"><input type="submit" value="Envoyer" style="background-color:#eef5fc; width:150;"></td> 
</table> 






A voir également:

1 réponse

kij_82 Messages postés 4088 Date d'inscription jeudi 7 avril 2005 Statut Contributeur Dernière intervention 30 septembre 2013 857
19 avril 2010 à 11:26
Bonjour,

Et quel est ton problème exactement ?
Dis nous en un peu plus s'il te plait si tu souhaite obtenir de l'aide. Des messages d'erreurs ? Où ? De quelle nature ? Quel libellé d'erreur exactement ? La ligne dans le code ?
0