stophking

Inscris le 09/07/2009 à 17:28
  • Signature
    stoph
  • Nombre de sujets
    2
  • Nombre de messages
    2
  • Nombre de commentaires
    Aucun
  • Nombre de news
    Aucune
  • Niveau en PHP
    Débutant

Ses dernières news

Aucune news

Ses derniers sujets sur les forums

forum
stophking
le 28/07/2010 à 00:28
galerie photo avec php/mysql
bonjour :
je suis entrain de créer une galerie photo avec php/mysql et j'aimeria bien que vous me corriger le code si il ya des fautes, et une chose que je veus bien si si possible c'est comment fiare un lien au-dessus des images se lien permettre de supprimer l'image de la base de données.

voila les codes de chaque page :

ajout.php
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
  3. <head>
  4. <title>Envoyer une image</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  6. <style type="text/css">
  7. label {
  8. display:block;
  9. width:150px;
  10. float:left;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <h1>Envoyer une image</h1>
  16. <form enctype="multipart/form-data" action="traitement.php" method="post">
  17. <p>
  18. <label for="nom">Nom : </label><input type="text" name="nom" id="nom" /><br />
  19. <label for="description">Description : </label><textarea name="description" id="description" rows="10" cols="50"></textarea><br />
  20. <label for="image">Image : </label><input type="file" name="image" id="image" /><br />
  21. <label for="validation">Valider : </label><input type="submit" name="validation" id="validation" value="Envoyer" />
  22. </p>
  23. </form>
  24. </body>
  25. </html>




traitement.php
  1. <?php
  2. if(isset($_POST['validation'])) {

  3. //Indique si le fichier a été téléchargé
  4. if(!is_uploaded_file($_FILES['image']['tmp_name']))
  5. echo 'Un problème est survenu durant l opération. Veuillez réessayer !';
  6. else {
  7. //liste des extensions possibles
  8. $extensions = array('/png', '/gif', '/jpg', '/jpeg');

  9. //récupère la chaîne à partir du dernier / pour connaître l'extension
  10. $extension = strrchr($_FILES['image']['type'], '/');

  11. //vérifie si l'extension est dans notre tableau
  12. if(!in_array($extension, $extensions))
  13. echo 'Vous devez uploader un fichier de type png, gif, jpg, jpeg.';
  14. else {

  15. //on définit la taille maximale
  16. define('MAXSIZE', 300000);
  17. if($_FILES['image']['size'] > MAXSIZE)
  18. echo 'Votre image est supérieure à la taille maximale de '.MAXSIZE.' octets';
  19. else {
  20. //on se connecte (remplacer les paramètres de connexion)
  21. $connexion = mysql_connect("localhost", "root", "") or exit (mysql_error());
  22. $database = mysql_select_db("tata") or exit (mysql_error());

  23. //récupération des infos saisies
  24. $nom = mysql_escape_string($_POST['nom']);
  25. $description = mysql_escape_string($_POST['description']);

  26. //Lecture du fichier. On doit utiliser la fonction mysql_escape_string car les données binaires contiennent des caractères spéciaux.
  27. $image = mysql_escape_string(file_get_contents($_FILES['image']['tmp_name']));

  28. //Il ne reste qu'à insérer tout ça dans notre table.
  29. mysql_query("INSERT INTO images(nom, description, img, extension) VALUES('".$nom."', '".$description."', '".$image."', '".$_FILES[image][type]."')") or exit (mysql_error());
  30. mysql_close();
  31. echo 'L insertion s est bien déroulée !';
  32. }
  33. }
  34. }
  35. }
  36. ?>




apercu.php
  1. <?php
  2. //si nous avons une image
  3. if(!empty($_GET['id_img'])) {

  4. //connexion à la base de données
  5. $connexion = mysql_connect("localhost", "root", "") or exit (mysql_error());
  6. $database = mysql_select_db("BASE")or exit (mysql_error());

  7. //on sécurise notre donnée
  8. $idImg = intval($_GET['id_img']);

  9. //la requète qui récupère l'image à partir de l'identifiant
  10. $apercu = mysql_query("SELECT extension, img FROM images WHERE id_img = ".$idImg) or exit (mysql_error());

  11. //si le résultat est différent de 1
  12. if(mysql_num_rows($apercu) != 1)
  13. echo 'L image n existe pas !';
  14. else {
  15. //on stocke les données dans un tableau
  16. $reponse = mysql_fetch_assoc($apercu);
  17. //on indique qu'on affiche une image
  18. header ("Content-type: ".$reponse['extension']);
  19. //on affiche l'image en elle même
  20. echo $reponse['img'];
  21. }
  22. mysql_close();
  23. } else
  24. echo 'Vous n avez pas sélectionné d image !';
  25. ?>




galerie.php
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
  3. <head>
  4. <title>Ma galerie d'images</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  6. <style type="text/css">
  7. body {
  8. width: 95%;
  9. }

  10. div {
  11. width: 22%;
  12. float: left;
  13. text-align: center;
  14. border: 1px solid black;
  15. margin: 5px;
  16. padding: 5px;
  17. }

  18. p {
  19. text-align: left;
  20. }

  21. a {
  22. color: #000000;
  23. text-decoration: none;
  24. }
  25. </style>
  26. </head>
  27. <body>

  28. <h1>Ma galerie d'images</h1>

  29. <?php
  30. $connexion = mysql_connect("localhost", "root", "") or exit (mysql_error());
  31. $database = mysql_select_db("images") or exit (mysql_error());

  32. $affichage = mysql_query("SELECT id_img, nom, description FROM images") or exit (mysql_error());
  33. while($result = mysql_fetch_assoc($affichage)) {

  34. echo '<div>';
  35. echo '<a href="apercu.php?id_img='.$result[id_img].'"><img src="apercu.php?id_img='.$result[id_img].'" alt="'.$result[nom].'" title="'.$result[nom].'" /></a>';
  36. echo '<p>Description : '.$result["description"].'</p>';
  37. echo '</div>';
  38. }
  39. mysql_close();
  40. ?>

  41. </body>
  42. </html>




et voila la base "images" que j'ai créer :

CREATE TABLE `images` (
`id_img` INT NOT NULL AUTO_INCREMENT,
`nom` VARCHAR(50) NOT NULL,
`description` text NOT NULL,
`img` BLOB NOT NULL,
`extension` VARCHAR(25) NOT NULL,
PRIMARY KEY (`id_img`)
)

J 'attend une reponse et un aide
merci beaucoup
stoph
stophking
le 09/07/2009 à 17:30
Envoi de mail via PHP
bonjour c'est mon premier sujet ici dans ce forum, j'ai besoin de votre aide pour resoudre un probleme.
j'ai créer un formulaire html et j'aimerais recevoir les données de se formulaire dans ma boite email
biensur j'ai créer un script php qui execute se travial mais je ne sais pas ou est le probleme parce que il ne marche toujour pas :(

voila le code html du formulaire

  1. <form method=post action=inscription.php >
  2. <table width="75%" border="0" cellspacing="0" cellpadding="0" align="left">
  3. <tr>
  4. <td width="111" height="25" align="right">Nom :</td>
  5. <td width="15">&nbsp;</td>
  6. <td width="199" align="left"><input style="text-transform: uppercase; color: rgb(5, 70, 126);" type="text" name="nom" /></td>
  7. <td width="15">&nbsp;</td>
  8. <td width="294">Formulez ci-dessous votre demande : </td>
  9. </tr>
  10. <tr>
  11. <td height="25" align="right">Pr&eacute;nom :</td>
  12. <td>&nbsp;</td>
  13. <td align="left"><input style="color: rgb(5, 70, 126);" type="text" name="prenom" /></td>
  14. <td>&nbsp;</td>
  15. <td rowspan="7" valign="top"><table width="80%" border="0" cellspacing="0" cellpadding="0">
  16. <tr>
  17. <td valign="top"><textarea name="message" cols="25" rows="20"></textarea></td>
  18. </tr>
  19. </table></td>
  20. </tr>
  21. <tr>
  22. <td height="25" align="right">Niveau D'&eacute;tude:</td>
  23. <td>&nbsp;</td>
  24. <td align="left"><input name="niveau" type="text" id="niveau" style="color: rgb(5, 70, 126);" /></td>
  25. <td></td>
  26. </tr>
  27. <tr>
  28. <td height="25" align="right">Activit&eacute; : </td>
  29. <td>&nbsp;</td>
  30. <td align="left"><input style="color: rgb(5, 70, 126);" type="text" name="activite" /></td>
  31. <td>&nbsp;</td>
  32. </tr>
  33. <tr>
  34. <td height="25" align="right">Adresse :</td>
  35. <td>&nbsp;</td>
  36. <td align="left"><input style="color: rgb(5, 70, 126);" name="adresse" type="text" maxlength="80" /></td>
  37. <td>&nbsp;</td>
  38. </tr>
  39. <tr>
  40. <td height="25" align="right">Code postal :</td>
  41. <td width="15">&nbsp;</td>
  42. <td align="left"><input style="color: rgb(5, 70, 126);" name="codepostal" type="text" maxlength="5" /></td>
  43. <td width="15">&nbsp;</td>
  44. </tr>
  45. <tr>
  46. <td height="25" align="right">Ville :</td>
  47. <td>&nbsp;</td>
  48. <td align="left"><input style="text-transform: uppercase; color: rgb(5, 70, 126);" name="ville" type="text" maxlength="50" /></td>
  49. <td>&nbsp;</td>
  50. </tr>
  51. <tr>
  52. <td height="25" align="right">Pays :</td>
  53. <td>&nbsp;</td>
  54. <td align="left"><input style="text-transform: uppercase; color: rgb(5, 70, 126);" type="text" name="pays" /></td>
  55. <td>&nbsp;</td>
  56. </tr>
  57. <tr>
  58. <td height="25" align="right">T&eacute;l&eacute;phone :</td>
  59. <td>&nbsp;</td>
  60. <td align="left"><input name="telephone" type="text" style="color: rgb(5, 70, 126);" maxlength="10" /></td>
  61. <td>&nbsp;</td>
  62. <td rowspan="2" align="left" valign="top"> D&eacute;sirez-vous une plaquette &nbsp;&nbsp;&nbsp;
  63. OUI
  64. <input type="radio" name="plaquette" value="oui" />
  65. NON
  66. <input type="radio" name="plaquette" value="non" checked="checked" /></td>
  67. </tr>
  68. <tr>
  69. <td height="25" align="right">Fax :</td>
  70. <td>&nbsp;</td>
  71. <td align="left"><input style="color: rgb(5, 70, 126);" name="fax" type="text" maxlength="10" /></td>
  72. <td>&nbsp;</td>
  73. </tr>
  74. <tr>
  75. <td height="25" align="right">E-mail :</td>
  76. <td>&nbsp;</td>
  77. <td align="left"><input style="color: rgb(5, 70, 126);" type="text" name="to" /></td>
  78. <td>&nbsp;</td>
  79. <td align="center"><input style="color: rgb(5, 70, 126);" type="reset" name="annuler" value="Annuler" />
  80. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  81. <input style="color: rgb(5, 70, 126);" type="button" name="Submit" value="Envoyer" /></td>
  82. </tr>
  83. </table>

  84. </form>


et voici le code PHP


  1. <?php // Début du PHP


  2. $nom = $_POST["nom"];
  3. $prenom = $_POST["prenom"];
  4. $message = $_POST["message"];
  5. $societe = $_POST["societe"];
  6. $activite = $_POST["activite"];
  7. $adresse = $_POST["adresse"];
  8. $codepostal = $_POST["codepostal"];
  9. $ville = $_POST["ville"];
  10. $pays = $_POST["pays"];
  11. $telephone = $_POST["telephone"];
  12. $fax = $_POST["fax"];
  13. $to = $_POST["to"];
  14. $plaquette = $_POST["plaquette"];

  15. $from = "stophweb@hotmail.com"; // adresse d'exemple
  16. $entete = "MIME-Version: 1.0\r\n";
  17. $entete .= "Content-type: text/html; charset=iso-8859-1\r\n";
  18. $entete .= "From: $from <stophweb@hotmail.com>\r\n";
  19. $entete .= "Reply-to: $from\r\n";
  20. $entete .= "X-Mailer: PHP\r\n";
  21. $entete .= "X-Priority: 1\r\n";
  22. $entete .= "Return-Path: <stophweb@hotmail.com> \r\n";

  23. //sujet du mail
  24. $sujet = "Demande d'inscrption ou d'information\r\n";
  25. //preparation du texte du mail (\r\n correspond au retour à la ligne)
  26. $mge = "Vous avez reçu une demande d'inscrption de la part de : \r\n
  27. Nom : ".$nom."\r\n
  28. Prenom : ".$prenom."\r\n
  29. Societe : ".$societe."\r\n
  30. Activite : ".$activite."\r\n
  31. Adresse : ".$adresse."\r\n
  32. Code-Postal : ".$codepostal."\r\n
  33. Ville : ".$ville."\r\n
  34. Telephone :".$telephone."\r\n
  35. Fax : ".$fax."\r\n
  36. Email : ".$to."\r\r\n
  37. Message : ".$message."\r\r\n
  38. Plaquette demandée : ".$plaquette;

  39. //Envoi du mail
  40. if (mail($to,$sujet,$mge,$entete))

  41. {
  42. include("ac.php");

  43. }
  44. else
  45. {
  46. include("err.php");
  47. }

  48. // Fin du PHP


  49. ?>



merci pour votre aide d'avance :)
stoph

Ses derniers messages sur les forums

forum
stophking
le 28/07/2010 à 00:28
galerie photo avec php/mysql
bonjour :
je suis entrain de créer une galerie photo avec php/mysql et j'aimeria bien que vous me corriger le code si il ya des fautes, et une chose que je veus bien si si possible c'est comment fiare un lien au-dessus des images se lien permettre de supprimer l'image de la base de données.

voila les codes de chaque page :

ajout.php
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
  3. <head>
  4. <title>Envoyer une image</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  6. <style type="text/css">
  7. label {
  8. display:block;
  9. width:150px;
  10. float:left;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <h1>Envoyer une image</h1>
  16. <form enctype="multipart/form-data" action="traitement.php" method="post">
  17. <p>
  18. <label for="nom">Nom : </label><input type="text" name="nom" id="nom" /><br />
  19. <label for="description">Description : </label><textarea name="description" id="description" rows="10" cols="50"></textarea><br />
  20. <label for="image">Image : </label><input type="file" name="image" id="image" /><br />
  21. <label for="validation">Valider : </label><input type="submit" name="validation" id="validation" value="Envoyer" />
  22. </p>
  23. </form>
  24. </body>
  25. </html>




traitement.php
  1. <?php
  2. if(isset($_POST['validation'])) {

  3. //Indique si le fichier a été téléchargé
  4. if(!is_uploaded_file($_FILES['image']['tmp_name']))
  5. echo 'Un problème est survenu durant l opération. Veuillez réessayer !';
  6. else {
  7. //liste des extensions possibles
  8. $extensions = array('/png', '/gif', '/jpg', '/jpeg');

  9. //récupère la chaîne à partir du dernier / pour connaître l'extension
  10. $extension = strrchr($_FILES['image']['type'], '/');

  11. //vérifie si l'extension est dans notre tableau
  12. if(!in_array($extension, $extensions))
  13. echo 'Vous devez uploader un fichier de type png, gif, jpg, jpeg.';
  14. else {

  15. //on définit la taille maximale
  16. define('MAXSIZE', 300000);
  17. if($_FILES['image']['size'] > MAXSIZE)
  18. echo 'Votre image est supérieure à la taille maximale de '.MAXSIZE.' octets';
  19. else {
  20. //on se connecte (remplacer les paramètres de connexion)
  21. $connexion = mysql_connect("localhost", "root", "") or exit (mysql_error());
  22. $database = mysql_select_db("tata") or exit (mysql_error());

  23. //récupération des infos saisies
  24. $nom = mysql_escape_string($_POST['nom']);
  25. $description = mysql_escape_string($_POST['description']);

  26. //Lecture du fichier. On doit utiliser la fonction mysql_escape_string car les données binaires contiennent des caractères spéciaux.
  27. $image = mysql_escape_string(file_get_contents($_FILES['image']['tmp_name']));

  28. //Il ne reste qu'à insérer tout ça dans notre table.
  29. mysql_query("INSERT INTO images(nom, description, img, extension) VALUES('".$nom."', '".$description."', '".$image."', '".$_FILES[image][type]."')") or exit (mysql_error());
  30. mysql_close();
  31. echo 'L insertion s est bien déroulée !';
  32. }
  33. }
  34. }
  35. }
  36. ?>




apercu.php
  1. <?php
  2. //si nous avons une image
  3. if(!empty($_GET['id_img'])) {

  4. //connexion à la base de données
  5. $connexion = mysql_connect("localhost", "root", "") or exit (mysql_error());
  6. $database = mysql_select_db("BASE")or exit (mysql_error());

  7. //on sécurise notre donnée
  8. $idImg = intval($_GET['id_img']);

  9. //la requète qui récupère l'image à partir de l'identifiant
  10. $apercu = mysql_query("SELECT extension, img FROM images WHERE id_img = ".$idImg) or exit (mysql_error());

  11. //si le résultat est différent de 1
  12. if(mysql_num_rows($apercu) != 1)
  13. echo 'L image n existe pas !';
  14. else {
  15. //on stocke les données dans un tableau
  16. $reponse = mysql_fetch_assoc($apercu);
  17. //on indique qu'on affiche une image
  18. header ("Content-type: ".$reponse['extension']);
  19. //on affiche l'image en elle même
  20. echo $reponse['img'];
  21. }
  22. mysql_close();
  23. } else
  24. echo 'Vous n avez pas sélectionné d image !';
  25. ?>




galerie.php
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
  3. <head>
  4. <title>Ma galerie d'images</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  6. <style type="text/css">
  7. body {
  8. width: 95%;
  9. }

  10. div {
  11. width: 22%;
  12. float: left;
  13. text-align: center;
  14. border: 1px solid black;
  15. margin: 5px;
  16. padding: 5px;
  17. }

  18. p {
  19. text-align: left;
  20. }

  21. a {
  22. color: #000000;
  23. text-decoration: none;
  24. }
  25. </style>
  26. </head>
  27. <body>

  28. <h1>Ma galerie d'images</h1>

  29. <?php
  30. $connexion = mysql_connect("localhost", "root", "") or exit (mysql_error());
  31. $database = mysql_select_db("images") or exit (mysql_error());

  32. $affichage = mysql_query("SELECT id_img, nom, description FROM images") or exit (mysql_error());
  33. while($result = mysql_fetch_assoc($affichage)) {

  34. echo '<div>';
  35. echo '<a href="apercu.php?id_img='.$result[id_img].'"><img src="apercu.php?id_img='.$result[id_img].'" alt="'.$result[nom].'" title="'.$result[nom].'" /></a>';
  36. echo '<p>Description : '.$result["description"].'</p>';
  37. echo '</div>';
  38. }
  39. mysql_close();
  40. ?>

  41. </body>
  42. </html>




et voila la base "images" que j'ai créer :

CREATE TABLE `images` (
`id_img` INT NOT NULL AUTO_INCREMENT,
`nom` VARCHAR(50) NOT NULL,
`description` text NOT NULL,
`img` BLOB NOT NULL,
`extension` VARCHAR(25) NOT NULL,
PRIMARY KEY (`id_img`)
)

J 'attend une reponse et un aide
merci beaucoup
stoph
stophking
le 09/07/2009 à 17:30
Envoi de mail via PHP
bonjour c'est mon premier sujet ici dans ce forum, j'ai besoin de votre aide pour resoudre un probleme.
j'ai créer un formulaire html et j'aimerais recevoir les données de se formulaire dans ma boite email
biensur j'ai créer un script php qui execute se travial mais je ne sais pas ou est le probleme parce que il ne marche toujour pas :(

voila le code html du formulaire

  1. <form method=post action=inscription.php >
  2. <table width="75%" border="0" cellspacing="0" cellpadding="0" align="left">
  3. <tr>
  4. <td width="111" height="25" align="right">Nom :</td>
  5. <td width="15">&nbsp;</td>
  6. <td width="199" align="left"><input style="text-transform: uppercase; color: rgb(5, 70, 126);" type="text" name="nom" /></td>
  7. <td width="15">&nbsp;</td>
  8. <td width="294">Formulez ci-dessous votre demande : </td>
  9. </tr>
  10. <tr>
  11. <td height="25" align="right">Pr&eacute;nom :</td>
  12. <td>&nbsp;</td>
  13. <td align="left"><input style="color: rgb(5, 70, 126);" type="text" name="prenom" /></td>
  14. <td>&nbsp;</td>
  15. <td rowspan="7" valign="top"><table width="80%" border="0" cellspacing="0" cellpadding="0">
  16. <tr>
  17. <td valign="top"><textarea name="message" cols="25" rows="20"></textarea></td>
  18. </tr>
  19. </table></td>
  20. </tr>
  21. <tr>
  22. <td height="25" align="right">Niveau D'&eacute;tude:</td>
  23. <td>&nbsp;</td>
  24. <td align="left"><input name="niveau" type="text" id="niveau" style="color: rgb(5, 70, 126);" /></td>
  25. <td></td>
  26. </tr>
  27. <tr>
  28. <td height="25" align="right">Activit&eacute; : </td>
  29. <td>&nbsp;</td>
  30. <td align="left"><input style="color: rgb(5, 70, 126);" type="text" name="activite" /></td>
  31. <td>&nbsp;</td>
  32. </tr>
  33. <tr>
  34. <td height="25" align="right">Adresse :</td>
  35. <td>&nbsp;</td>
  36. <td align="left"><input style="color: rgb(5, 70, 126);" name="adresse" type="text" maxlength="80" /></td>
  37. <td>&nbsp;</td>
  38. </tr>
  39. <tr>
  40. <td height="25" align="right">Code postal :</td>
  41. <td width="15">&nbsp;</td>
  42. <td align="left"><input style="color: rgb(5, 70, 126);" name="codepostal" type="text" maxlength="5" /></td>
  43. <td width="15">&nbsp;</td>
  44. </tr>
  45. <tr>
  46. <td height="25" align="right">Ville :</td>
  47. <td>&nbsp;</td>
  48. <td align="left"><input style="text-transform: uppercase; color: rgb(5, 70, 126);" name="ville" type="text" maxlength="50" /></td>
  49. <td>&nbsp;</td>
  50. </tr>
  51. <tr>
  52. <td height="25" align="right">Pays :</td>
  53. <td>&nbsp;</td>
  54. <td align="left"><input style="text-transform: uppercase; color: rgb(5, 70, 126);" type="text" name="pays" /></td>
  55. <td>&nbsp;</td>
  56. </tr>
  57. <tr>
  58. <td height="25" align="right">T&eacute;l&eacute;phone :</td>
  59. <td>&nbsp;</td>
  60. <td align="left"><input name="telephone" type="text" style="color: rgb(5, 70, 126);" maxlength="10" /></td>
  61. <td>&nbsp;</td>
  62. <td rowspan="2" align="left" valign="top"> D&eacute;sirez-vous une plaquette &nbsp;&nbsp;&nbsp;
  63. OUI
  64. <input type="radio" name="plaquette" value="oui" />
  65. NON
  66. <input type="radio" name="plaquette" value="non" checked="checked" /></td>
  67. </tr>
  68. <tr>
  69. <td height="25" align="right">Fax :</td>
  70. <td>&nbsp;</td>
  71. <td align="left"><input style="color: rgb(5, 70, 126);" name="fax" type="text" maxlength="10" /></td>
  72. <td>&nbsp;</td>
  73. </tr>
  74. <tr>
  75. <td height="25" align="right">E-mail :</td>
  76. <td>&nbsp;</td>
  77. <td align="left"><input style="color: rgb(5, 70, 126);" type="text" name="to" /></td>
  78. <td>&nbsp;</td>
  79. <td align="center"><input style="color: rgb(5, 70, 126);" type="reset" name="annuler" value="Annuler" />
  80. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  81. <input style="color: rgb(5, 70, 126);" type="button" name="Submit" value="Envoyer" /></td>
  82. </tr>
  83. </table>

  84. </form>


et voici le code PHP


  1. <?php // Début du PHP


  2. $nom = $_POST["nom"];
  3. $prenom = $_POST["prenom"];
  4. $message = $_POST["message"];
  5. $societe = $_POST["societe"];
  6. $activite = $_POST["activite"];
  7. $adresse = $_POST["adresse"];
  8. $codepostal = $_POST["codepostal"];
  9. $ville = $_POST["ville"];
  10. $pays = $_POST["pays"];
  11. $telephone = $_POST["telephone"];
  12. $fax = $_POST["fax"];
  13. $to = $_POST["to"];
  14. $plaquette = $_POST["plaquette"];

  15. $from = "stophweb@hotmail.com"; // adresse d'exemple
  16. $entete = "MIME-Version: 1.0\r\n";
  17. $entete .= "Content-type: text/html; charset=iso-8859-1\r\n";
  18. $entete .= "From: $from <stophweb@hotmail.com>\r\n";
  19. $entete .= "Reply-to: $from\r\n";
  20. $entete .= "X-Mailer: PHP\r\n";
  21. $entete .= "X-Priority: 1\r\n";
  22. $entete .= "Return-Path: <stophweb@hotmail.com> \r\n";

  23. //sujet du mail
  24. $sujet = "Demande d'inscrption ou d'information\r\n";
  25. //preparation du texte du mail (\r\n correspond au retour à la ligne)
  26. $mge = "Vous avez reçu une demande d'inscrption de la part de : \r\n
  27. Nom : ".$nom."\r\n
  28. Prenom : ".$prenom."\r\n
  29. Societe : ".$societe."\r\n
  30. Activite : ".$activite."\r\n
  31. Adresse : ".$adresse."\r\n
  32. Code-Postal : ".$codepostal."\r\n
  33. Ville : ".$ville."\r\n
  34. Telephone :".$telephone."\r\n
  35. Fax : ".$fax."\r\n
  36. Email : ".$to."\r\r\n
  37. Message : ".$message."\r\r\n
  38. Plaquette demandée : ".$plaquette;

  39. //Envoi du mail
  40. if (mail($to,$sujet,$mge,$entete))

  41. {
  42. include("ac.php");

  43. }
  44. else
  45. {
  46. include("err.php");
  47. }

  48. // Fin du PHP


  49. ?>



merci pour votre aide d'avance :)
stoph

Ses derniers commentaires de news

Aucun commentaire de news

Ses derniers commentaires de sites

Aucun commentaire de sites

Ses derniers commentaires de wall

Aucun commentaire wall
LoadingChargement en cours