fscalda | La suite de l'autre topic .
Voila, le probleme, c'est que dès que je mets une apostrophe ' dans un des champs du formulaire, j'ai une erreur . Je ne sais pas comment faire pour empecher ça.
le formulaire d'envoie Code :
- <form action="valide.php" method="post">
- <table cellspacing=0 cellpadding=0 width=511 border=0>
- <tbody>
- <tr>
- <td class=bold colspan=3><img height=16
- src="Lesaboteur_com%20-%20Th%E9mes%20de%20bureau%20-%20Galerie%20photos_fichiers/t_an-12pens-demande.gif"
- width=511></td>
- </tr>
- <tr>
- <td colspan=3><img height=34
- src="Lesaboteur_com%20-%20Th%E9mes%20de%20bureau%20-%20Galerie%20photos_fichiers/bloc-haut.gif"
- width=511></td>
- </tr>
- <tr>
- <td
- background="Lesaboteur_com%20-%20Th%E9mes%20de%20bureau%20-%20Galerie%20photos_fichiers/pix-noir.gif"
- height="100%"><img height="100%"
- src="Lesaboteur_com%20-%20Th%E9mes%20de%20bureau%20-%20Galerie%20photos_fichiers/pix-noir.gif"
- width=1></td>
- <td width=492> <br>
- <table cellspacing=0 cellpadding=0 width=492 border=0>
- <tbody>
- <tr>
- <td><font face=arial color=#000000 size=2>Nom ou pseudo :</font></td>
- <td>
- <input type="text" name="nom">
- </td>
- </tr>
- <tr>
- <td><font face=arial color=#000000 size=2>Votre Email : </font></td>
- <td>
- <input type="text" name="email">
- </td>
- </tr>
- <tr>
- <td><font face=arial color=#000000 size=2>Telephone :</font></td>
- <td>
- <input type="text" name="telephone">
- </td>
- </tr>
- <tr>
- <td><font face=arial color=#000000 size=2>Portable :</font></td>
- <td>
- <input type="text" name="portable">
- </td>
- </tr>
- <tr>
- <td><font face=arial color=#000000 size=2>Lieu :</font></td>
- <td>
- <input type="text" name="lieu">
- </td>
- </tr>
- <tr>
- <td>Pays :</td>
- <td>
- <input type="text" name="pays">
- </td>
- </tr>
- <tr>
- <td colspan="2"><br>
- <font face=arial color=#000000 size=2>Titre:</font><br>
- <input type="text" name="titre">
- </td>
- </tr>
- <tr>
- <td colspan="2"><font face=arial color=#000000 size=2>Annonce
- :</font><br>
- <textarea style="FONT-SIZE: 10px; COLOR: #000000; FONT-FAMILY: arial; BACKGROUND-COLOR: #ffffff" name="message" rows=10 cols=70></textarea>
- <br>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <div align="center">
- <input type="submit" value="cliquez-ici">
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </td>
- <td width=18
- background="Lesaboteur_com%20-%20Th%E9mes%20de%20bureau%20-%20Galerie%20photos_fichiers/pix-droite.gif"
- height="100%"><img height=8
- src="Lesaboteur_com%20-%20Th%E9mes%20de%20bureau%20-%20Galerie%20photos_fichiers/pix-droite.gif"
- width=18></td>
- </tr>
- <tr>
- <td colspan=3><img height=36
- src="Lesaboteur_com - Thémes de bureau - Galerie photos_fichiers\bloc-bas(1).gif"
- width=511></td>
- </tr>
- </tbody>
- </table>
- </form>
|
la page qui recupere le code pour l'envoyer dans la base
Code :
- <?PHP
- // Connexion ici
- $db = mysql_connect('localhost', 'root', '');
- mysql_select_db('annonce',$db);
- //variable nom email telephone portable lieu pays titre message
- $date = date ("Y-m-d" );
- $query = "INSERT INTO webmaster(date,nom, email, telephone, portable, lieu, pays, titre, message)
- VALUES(NOW(),'".$_POST["nom"]."','".$_POST["email"]."','".$_POST["telephone"]."','".$_POST["portable"]."','".$_POST["lieu"]."','".$_POST["pays"]."','".$_POST["titre"]."' ,'".$_POST["message"]."')";
- $res=mysql_query($query) or die(mysql_error());
- //texte de fin
- //rajouter plutot un lien vers une page
- echo 'merci beaucoup, vos infos ont été enregistrées.';
- mysql_close();
- ?>
|
|