1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
<?php
/*
Fichier index.php, page d'accueil
Date de création : 09/01/2012
*/
$chem = '';
$page = 'contact.php';
// Référencement
$titre = "xxx";
$motscles = "xxx";
$description = "xxx";
//inclusion en-tête et menu
include("include/haut.inc.php");
include("include/gauche.inc.php");
?>
<div id="contenu">
<?php
//connexion bdd
include("include/connexion.inc.php");
?>
<h2>Contactez-nous</h2>
<br />
<p>Une question ? Une remarque ? Un conseil ? N'hésitez pas à nous contacter par le formulaire ci-dessous.</p>
<br /><br />
<div>
<!--formulaire de contact-->
<div>
<form action="#envoi_msg" method="post">
<table>
<tr>
<th><label>Nom et prénom</label> :</th>
<td><input type="text" id="nom" name="nom" size="30" /></td>
</tr>
<tr>
<th><label>E-mail</label>:</th>
<td><input type="text" id="email" name="email" size="30" /></td>
</tr>
<tr>
<th><label>Objet du message</label>:</th>
<td><input type="text" id="objet" name="objet" size="30" /></td>
</tr>
<tr>
<td colspan="2"><textarea name="msg" class="input_texte textarea" rows="15" cols="40" >Votre message...</textarea></td>
</tr>
</table>
<input type="submit" name="Envoyer" value="Envoyer" class="bouton" />
</form>
</div>
</div>
<br />
<div id="envoi_msg">
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{ //Envoi du message
$corps = 'Message posté depuis le site xxx\n
Le message a été posté par '.$_POST['nom'].'\n
Message :'.$_POST['msg'];
$headers='From: "xxx - Contact "<'.$_POST['email'].'>';
if(mail('xx@xxx.com',$_POST['objet'],$corps,$headers))
{
echo 'Votre message a été envoyé à* <b>xxx</b><br />
Nous vous remercions de l\'intérêt que vous nous portez.<br />';
// enrg bdd
$sql = "INSERT INTO contact(emetteur, msg) VALUES('".$_POST['nom']."','".$_POST['msg']."')";
$req= mysql_query($sql);
}
else
{ echo 'Votre message <b>n\'a pas été envoyé.</b><br />';
}
}
?>
</div>
</div>
<?php
//inclusion pied de page
include("include/bas.inc.php");
?> |
Partager