Bonjour, j'ai un template "tout fait" pour apprendre. J'arrive à me débrouiller, mais je bloque sur le formulaire de contact. Je n'arrive pas à le faire fonctionner!!!! Smiley fache je vous copie les parties HTML (parties concernées de la page html). Si vous pouviez me donner la solution??? Merci à tous
Partie1
<div class="page_full">
<div class="menu menu_bg">
<div class="container">
<div class="page_full">
<div class="menu_top">
<div id="top_menu">
<div class="fright">
<div class="top_search">
<form action="mail.php" method="post">
<input name="name" type="text" value="Search the site" onFocus="if (this.value == 'Search the site') this.value = '';" onBlur="if (this.value == '') this.value = 'Search the site';" />
<input type="submit" class="search_btn" value=" " />
<div class="clear"></div>
</form>
</div>
</div>
<div class="fleft">
<!--menu-->
Partie 2
<div class="page_full">
<div class="menu menu_bg">
<div class="container">
<div class="page_full">
<div class="menu_top">
<div id="top_menu">
<div class="fright">
<div class="top_search">
<form action="" method="post">
<input name="name" type="text" value="Search the site" onFocus="if (this.value == 'Search the site') this.value = '';" onBlur="if (this.value == '') this.value = 'Search the site';" />
<input type="submit" class="search_btn" value=" " />
<div class="clear"></div>
</form>
</div>
</div>
<div class="fleft">
<!--menu-->
Modifié par pilou18 (22 Nov 2014 - 14:31)
Maintenant LES fichiers php de ce template
fichier mail.php
<?php
// Where will you get the forms' results?
define("CONTACT_FORM", 'yourname@yourdomain.com');
?>

fichier contact-process.php
<?php

include dirname(dirname(__FILE__)).'/mail.php';

error_reporting (E_ALL ^ E_NOTICE);

$post = (!empty($_POST)) ? true : false;

if($post)
{
include 'email_validation.php';

$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);


$error = '';

// Check name

if(!$name)
{
$error .= 'Please enter your name.<br />';
}

// Check email

if(!$email)
{
$error .= 'Please enter an e-mail address.<br />';
}

if($email && !ValidateEmail($email))
{
$error .= 'Please enter a valid e-mail address.<br />';
}

// Check message (length)

if(!$message || strlen($message) < 10)
{
$error .= "Please enter your message. It should have at least 10 characters.<br />";
}


if(!$error)
{
$mail = mail(CONTACT_FORM, $subject, $message,
"From: ".$name." <".$email.">\r\n"
."Reply-To: ".$email."\r\n"
."X-Mailer: PHP/" . phpversion());


if($mail)
{
echo 'OK';
}

}
else
{
echo '<div class="notification_error">'.$error.'</div>';
}

}
?>
fichier email_validation.ph

<?php
function ValidateEmail($value)
{
$regex = '/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i';

if($value == '') {
return false;
} else {
$string = preg_replace($regex, '', $value);
}

return empty($string) ? true : false;
}
?>

les fichiers contact_process.php et email-validation.php sont dans le même dossier nommé contact_form
Smiley confused espère avoir été clair dans mon souhait Smiley eek
Bonjour et bienvenue sur Alsa, pilou18 Smiley smile

Les codes HTML cités ne contiennent aucun formulaire de contact, mais plutôt un formulaire contenant un champ de recherche… relis-les, tu as du te tromper dans tes fichiers Smiley cligne
Modifié par audrasjb (22 Nov 2014 - 15:33)
Smiley lol Me suis-je effectivement trompé dans la copie!!!!LOL!!
Voilà TOUTE la page HTML.... Merci de ta réponse bon dimanche

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>THEME</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="css/prettyPhoto.css" rel="stylesheet" type="text/css" />
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/theme.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<link href="css/docs.css" rel="stylesheet">
<link href="js/google-code-prettify/prettify.css" rel="stylesheet">

<link href='http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Anton' rel='stylesheet' type='text/css'>

<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<!--wrapper-->
<div class="wrapper">
<div class="wrap">
<div class="container main_shadow backg">
<div class="page_full margin_forheader">

<!--main shadow-->
<!--header-->
<div class=" top_block">
<div class="container">
<p class="">Morbi erat lorem, fermentum in vestibulum et, suscipit in velit. Vivamus nisl risus, tristique vel bibendum vel, suscipit nec tellus. Maecenas</p>
</div>
</div>
<div class="header header_bg">
<div class="container">
<div class="page_full">
<div class="header_top">
<div class="container">
<div class="row">
<div class="span6">
<div class="logo"><a href="index.html"><img src="img/logo.png" alt="" /></a></div>
<div class="clear"></div>
</div>
<div class="span6">
<div class="follow_us">
<ul class="follow_us2">
<li><a href="#" class="facebook">Facebook</a></li>
<li><a href="#" class="twitter">Twitter</a></li>
<li><a href="#" class="flickr">flickr</a></li>
<li><a href="#" class="dribbble">dribbble</a></li>
<li><a href="#" class="rss">rss</a></li>
</ul>
<p>Call Us Now: +1 ( 777) 732-26-83</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="page_full">
<div class="menu menu_bg">
<div class="container">
<div class="page_full">
<div class="menu_top">
<div id="top_menu">
<div class="fright">
<div class="top_search">
<form action="mail.php" method="post">
<input name="name" type="text" value="Search the site" onFocus="if (this.value == 'Search the site') this.value = '';" onBlur="if (this.value == '') this.value = 'Search the site';" />
<input type="submit" class="search_btn" value=" " />
<div class="clear"></div>
</form>
</div>
</div>
<div class="fleft">
<!--menu-->
<nav id="main_menu">
<div class="menu_wrap">
<ul class="nav sf-menu">
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li class="sub-menu"><a href="javascript:{}">Features</a>
<ul>
<li><a href="scaffolding.html"><span>-</span>Scaffolding</a></li>
<li><a href="typography.html"><span>-</span>Typography</a></li>
<li><a href="shortcodes.html"><span>-</span>Shortcodes</a></li>
<li><a href="tables.html" class="last"><span>-</span>Tables</a></li>
</ul>
</li>
<li class="sub-menu"><a href="javascript:{}">Portfolio</a>
<ul>
<li><a href="portfolio_2columns.html"><span>-</span>2 Columns</a></li>
<li><a href="portfolio_3columns.html"><span>-</span>3 Columns</a></li>
<li><a href="portfolio_4columns.html" class="last"><span>-</span>4 Columns</a></li>
</ul>
</li>
<li class="sub-menu"><a href="javascript:{}">Blog</a>
<ul>
<li><a href="blog.html"><span>-</span>Blog with right sidebar</a></li>
<li><a href="blog_post.html" class="last"><span>-</span>Blog post</a></li>
</ul>
</li>
<li class="current"><a href="contacts.html">Contacts</a></li>
</ul>
<div class="clear"></div>
</div>
</nav>
<!--//menu -->
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>

</div>
<!--//header-->

<!--page_container-->
<div class="page_container">
<div>
<div class="container ">
<div class="page_full white_bg">

<div class="breadcrumb">
<div class="container">
<div class="blog_with_right_sidebar">
<div class="breadcrumb_title">Contacts - Lorem ipsum dolor sit</div>
<a href="index.html">Home</a><span>/</span>Contacts
</div>
</div>
</div>
<div class="container">
<div class="page_in">
<div class="container">
<section>
<div class="row">
<div class="span4">
<h2 class="title"><span>Contact Info</span></h2>
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2595.823708336861!2d1.0469010005248935!3d49.41223945172157!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0000000000000000%3A0x7f8f99c43655445d!2sCentre+d&#39;Incendie+et+de+Secours+(CIS)!5e0!3m2!1sfr!2sfr!4v1416068512438" width="600" height="450" frameborder="0" style="border:0"></iframe>
<p>3896 Kenwood Place<br/>Fort Lauderdale, FL 33301</p>
<p>Phone: 1-500-677-5694<br/>Fax: 1-500-256-2768<br/>Email: <a href="mailto:#">info@yoursitename.com</a><br/>Web: <a href="#">http://yoursitename.com</a></p>
</div>
<div class="span8">
<h2 class="title"><span>Get In Touch</span></h2>
<div class="contact_form">
<div id="note"></div>
<div id="fields">
<form id="ajax-contact-form" action="">
<input class="span7" type="text" name="name" value="" placeholder="Name (required)" />
<input class="span7" type="text" name="email" value="" placeholder="Email (required)" />
<input class="span7" type="text" name="subject" value="" placeholder="Subject" />
<textarea name="message" id="message" class="span8" placeholder="Message"></textarea>
<div class="clear"></div>
<input type="reset" class="btn dark_btn" value="Clear form" />
<input type="submit" class="btn send_btn" value="Submit" />
<div class="clear"></div>
</form>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</div>

</div>
</div>
</div>
</div>
<!--//page_container-->

<!--//main shadow-->

<!--footer-->
<div id="footer">
<div>
<div class="container">

<div class="page_full ">
<div class="container">
<div class="row">
<div class="span3">
<h2 class="title"><img src="img/foot_logo.png" alt="" /></h2>
<p class="marg_top5">There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.</p>
<p>If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat</p>
</div>
<div class="span3">
<div class="ftr_twit">
<h2 class="title"><span>Latest tweets</span></h2>
<div class="tweet_block"></div>
</div>
</div>
<div class="span3">
<h2 class="title"><span>Get in touch!</span></h2>
<form id="contact_form" method="post">
<input class="span3" type="text" name="name" id="name" value="Name" onFocus="if (this.value == 'Name') this.value = '';" onBlur="if (this.value == '') this.value = 'Name';" />
<input class="span3" type="text" name="email" id="email" value="Email" onFocus="if (this.value == 'Email') this.value = '';" onBlur="if (this.value == '') this.value = 'Email';" />
<textarea name="message" id="message" class="span3 foot_message" onFocus="if (this.value == 'Message...') this.value = '';" onBlur="if (this.value == '') this.value = 'Message...';" >Message...</textarea>
<div class="clear"></div>
<input type="reset" class="btn dark_btn" value="Clear form" />
<input type="submit" class="btn btn-success" value="Send" />
<div class="clear"></div>
</form>
</div>
<div class="span3">
<h2 class="title">Flickr</h2>
<div class="flickrs">
<div class="FlickrImages">
<ul></ul>
<div class="clear"></div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</div>

<div class="footer_bottom">
<div>
<div class="container footer_bg">

<div class="row">
<div class="span4"><div class="copyright">TOPMODELS &copy; 2020 | <a href="#">Privacy Policy</a></div></div>
<div class="span8 foot_menu">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="scaffolding.html">features</a></li>
<li><a href="portfolio_2columns.html">Portfolio</a></li>
<li><a href="blog.html">Blog</a></li>
<li><a href="contacts.html" class="current">Contacts</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>

</div>
<!--//footer-->
</div>
</div>
</div>
</div>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="js/google-code-prettify/prettify.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/superfish.js"></script>
<script type="text/javascript" src="js/jquery.tweet.js"></script>
<script type="text/javascript" src="js/jquery.prettyPhoto.js"></script>
<script type="text/javascript" src="js/myscript.js"></script>
<script src="js/application.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#ajax-contact-form").submit(function() {
var str = $(this).serialize();
$.ajax({
type: "POST",
url: "contact_form/contact_process.php",
data: str,
success: function(msg) {
// Message Sent - Show the 'Thank You' message and hide the form
if(msg == 'OK') {
result = '<div class="notification_ok">Your message has been sent. Thank you!</div>';
$("#fields").hide();
} else {
result = msg;
}
$('#note').html(result);
}
});
return false;
});
});
</script>
<script src="js/jquery.ui.totop.js" type="text/javascript"></script>
</body>
</html>