Formulaire de contact

Fermé
mediatech2000 Messages postés 4 Date d'inscription mercredi 21 octobre 2015 Statut Membre Dernière intervention 22 février 2016 - 18 févr. 2016 à 12:37
miramaze Messages postés 1429 Date d'inscription mercredi 29 juillet 2009 Statut Contributeur Dernière intervention 1 mai 2022 - 18 févr. 2016 à 23:26
Bonjour Tous le Monde

J'ai un souci de script sur mon formulaire de contact

il m'affiche une message suivant :

Parse error: syntax error, unexpected $end in C:\Web Server\xampp\htdocs\sites\afriqueabita\contact.php on line 155

voici le code
<?php
if(isset($_POST['nom_prenom']) and isset($_POST['email']) and isset($_POST['sujet']) and isset($_POST['message']))
{
$destinataire = 'siakamedia2000@gmail.com';
$email = htmlentities($_POST['email']);
if(preg_match('#^(([a-z0-9!\#$%&\\\'*+/=?^_`
~-]+)@(([a-z0-9-_]+\.?)*[a-z0-9-_]+)\.[a-z]{2,}$#i',str_replace('&','&',$email)))
{
$nom_prenom = 'Contact: '.stripslashes($_POST['nom_prenom']);
$sujet = 'Contact: '.stripslashes($_POST['sujet']);
$message = stripslashes($_POST['message']);
$headers = "From: <".$email.">\n";
$headers .= "Reply-To: ".$email."\n";
$headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"";
if(mail($destinataire,$nom_prenom,$sujet,$message,$headers))
{
echo "<strong>Votre message a bien été envoyé.</strong>";
}
else
{
echo "<strong style=\"color:#ff0000;\">Une erreur c'est produite lors de l'envois du message.</strong>";
}
}
else
{
echo "<strong style=\"color:#ff0000;\">L'email que vous avez entré est invalide.</strong>";
}
}
else
{
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link href="images/favicon.ico" rel="shortcut icon" />
<title>Contact</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" media="screen" href="css/reset.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/style.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/grid_12.css">
<link href='http://fonts.googleapis.com/css?family=Condiment' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Oxygen' rel='stylesheet' type='text/css'>
<script src="js/jquery-1.7.min.js"></script>
<script src="js/jquery.easing.1.3.js"></script>
<!--[if lt IE 8]>
<div style=' clear: both; text-align:center; position: relative;'>
<a href="https://support.microsoft.com/en-us/office/internet-explorer-help-23360e49-9cd3-4dda-ba52-705336cc0de2?ui=en-US&rs=en-001&ad=US">
<img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." />
</a>
</div>
<![endif]-->
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="css/ie.css">
<![endif]-->
</head>
<body>
<div class="main">
<!--==============================header=================================-->
<header>
<h1><a href="index.html"><img src="images/logo.png" width="240" height="130" border="0" alt="logo"></a></h1>
<div class="form-search">
<script>
(function() {
var cx = '001642925160567201580:jffbkdxwyg4';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>
</div>
<div class="clear"></div>
<nav class="box-shadow">
<div>
<ul class="menu">
<li class="home-page"><a href="index.html"><span></span></a></li>
<li><a href="presentation.html">Présentation</a></li>
<li><a href="nos_projets.html">Nos Projets</a></li>
<li><a href="offres.html">Offres</a></li>
<li><a href="services.html">Services</a></li>
<li><a href="souscription.php">Souscription</a></li>
<li class="current"><a href="contact.php">Contact</a></li>
</ul>
<div class="social-icons">
<span>Suivez-nous :</span>
<a href="https://twitter.com/intent/tweet?url=&original_referer=" class="twitter-share-button" data-via="afriqueabita">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<a href="https://www.facebook.com/login/?next=https%3A%2F%2Fwww.facebook.com%2Fafriqueabita1" class="icon-2"></a>
</div>
<div class="clear"></div>
</div>
</nav>
</header>
<!--==============================content================================-->
<section id="content">
<div class="container_12">
<div class="grid_12">
<div class="wrap pad-3">
<div class="block-5">
<h3 class="p5"><font color="#44a7bb">Trouvez-nous</font></h3>
<div class="map img-border">
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d31182.880324122925!2d-1.5262414619426963!3d12.325205818757922!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0xe2ebdee8072ff93%3A0x15cea85cab248f1d!2sPatte+d%C2%B4oie%2C+Ouagadougou!5e0!3m2!1sen!2sbf!4v1451568322227" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
</div>
<dl>
<dt>08 BP 11399 Ouagadougou 08,</dt>
<dd>Quartier Patte - d'Oie,<br>
Rue : 15.142, Porte : 98</dd>
<dd><span>Mobile 1 : </span>+226 77 99 79 79</dd>
<dd><span>Mobile 2 : </span>+226 75 98 33 00</dd>
<dd><span>E-mail: </span>afriqueabita@gmail.com</dd>
</dl>
</div>
<div class="block-61">
<h3><font color="#44a7bb">Formulaire de contact</font></h3>
<form id="form" method="post" target="" action="contact.php" >
<fieldset>
<label for="nom_prenom"><strong>Nom et Prénom*</strong><input type="text" name="nom_prenom" id="nom_prenom" /></label>
<label for="email"><strong>E-mail*</strong><input type="text" name="email" id="email" /></label></label>
<label for="sujet"><strong>Sujet*</strong><input type="text" name="sujet" id="sujet" /></label></label>
<label for="message"><strong>Message*</strong><textarea cols="70" rows="4" name="message" id="message"></textarea></br>
<div class="btns"><input type="submit" value="Envoyer" /></div>
</fieldset>
</form>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</section>
</div>
<div class="aside"></section>
<div class="container_12">
<div class="grid_12">
<div class="pad-2 wrap">
<h3 class="p5"><font color="#44a7bb">Nos Partenaires</font></h3>
<div class="wrap box-2">
<a href="#"><img src="images/banner-1.png" alt=""></a><a href="www.banqueatlantique.net"><img src="images/banner-2.png" alt=""></a><a href="#"><img src="images/banner-3.png" alt=""></a><a href="#"><img src="images/banner-4.png" alt=""></a><a href="#" class="last"><img src="images/banner-5.png" alt=""></a>
</div>
</div>
</div>
<div class="clear"> </div></div>

</div>
<!--==============================footer=================================-->
<footer>
<p>� 2016 Afrique Abita</p>
<p>Copyright : MEDIATECH2000</p>
</footer>
</body>
<?

?>

</html>

1 réponse

miramaze Messages postés 1429 Date d'inscription mercredi 29 juillet 2009 Statut Contributeur Dernière intervention 1 mai 2022 92
18 févr. 2016 à 23:26
Salut,

le message est plutôt clair, il manque une accolade:

<?php
if(isset($_POST['nom_prenom']) and isset($_POST['email']) and isset($_POST['sujet']) and isset($_POST['message']))
{
    $destinataire = 'siakamedia2000@gmail.com';
    $email = htmlentities($_POST['email']);
    if(preg_match('#^(([a-z0-9!\#$%&\\\'*+/=?^_`
~-]+)@(([a-z0-9-_]+\.?)*[a-z0-9-_]+)\.[a-z]{2,}$#i',str_replace('&','&',$email)))
    {
        $nom_prenom = 'Contact: '.stripslashes($_POST['nom_prenom']);
        $sujet = 'Contact: '.stripslashes($_POST['sujet']);
        $message = stripslashes($_POST['message']);
        $headers = "From: <".$email.">\n";
        $headers .= "Reply-To: ".$email."\n";
        $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"";
        if(mail($destinataire,$nom_prenom,$sujet,$message,$headers))
        {
            echo "<strong>Votre message a bien été envoyé.</strong>";
        }
        else
        {
            echo "<strong style=\"color:#ff0000;\">Une erreur c'est produite lors de l'envois du message.</strong>";
        }
    }
    else
    {
        echo "<strong style=\"color:#ff0000;\">L'email que vous avez entré est invalide.</strong>";
    }
}
else
{
?>
    <!DOCTYPE html>
    <html lang="en">
        <head>
            <link href="images/favicon.ico" rel="shortcut icon" />
            <title>Contact</title>
            <meta charset="utf-8">
            <link rel="stylesheet" type="text/css" media="screen" href="css/reset.css">
            <link rel="stylesheet" type="text/css" media="screen" href="css/style.css">
            <link rel="stylesheet" type="text/css" media="screen" href="css/grid_12.css">
            <link href='http://fonts.googleapis.com/css?family=Condiment' rel='stylesheet' type='text/css'>
            <link href='http://fonts.googleapis.com/css?family=Oxygen' rel='stylesheet' type='text/css'>
            <script src="js/jquery-1.7.min.js"></script>
            <script src="js/jquery.easing.1.3.js"></script>
	        <!--[if lt IE 8]>
                <div style=' clear: both; text-align:center; position: relative;'>
                <a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode">
                <img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." />
                </a>
                </div>
            <![endif]-->
            <!--[if lt IE 9]>
                <script type="text/javascript" src="js/html5.js"></script>
                <link rel="stylesheet" type="text/css" media="screen" href="css/ie.css">
	        <![endif]-->
        </head>
        <body>
            <div class="main">
                <!--==============================header=================================-->
                <header>
                    <h1><a href="index.html"><img src="images/logo.png" width="240" height="130" border="0" alt="logo"></a></h1>
                    <div class="form-search">
                        <script>
                         (function() {
                             var cx = '001642925160567201580:jffbkdxwyg4';
                             var gcse = document.createElement('script');
                             gcse.type = 'text/javascript';
                             gcse.async = true;
                             gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
                                        '//cse.google.com/cse.js?cx=' + cx;
                             var s = document.getElementsByTagName('script')[0];
                             s.parentNode.insertBefore(gcse, s);
                         })();
                        </script>
                        <gcse:search></gcse:search>
                    </div>
                    <div class="clear"></div>
                    <nav class="box-shadow">
                        <div>
                            <ul class="menu">
                                <li class="home-page"><a href="index.html"><span></span></a></li>
                                <li><a href="presentation.html">Présentation</a></li>
                                <li><a href="nos_projets.html">Nos Projets</a></li>
                                <li><a href="offres.html">Offres</a></li>
                                <li><a href="services.html">Services</a></li>
                                <li><a href="souscription.php">Souscription</a></li>
                                <li class="current"><a href="contact.php">Contact</a></li>
                            </ul>
                            <div class="social-icons">
                                <span>Suivez-nous :</span>
                                <a href="https://twitter.com/share" class="twitter-share-button" data-via="afriqueabita">Tweet</a>
                                <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
                                <a href="https://www.facebook.com/afriqueabita1" class="icon-2"></a>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </nav>
                </header>
                <!--==============================content================================-->
                <section id="content">
                    <div class="container_12">
                        <div class="grid_12">
                            <div class="wrap pad-3">
                                <div class="block-5">
                                    <h3 class="p5"><font color="#44a7bb">Trouvez-nous</font></h3>
                                    <div class="map img-border">
                                        <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d31182.880324122925!2d-1.5262414619426963!3d12.325205818757922!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0xe2ebdee8072ff93%3A0x15cea85cab248f1d!2sPatte+d%C2%B4oie%2C+Ouagadougou!5e0!3m2!1sen!2sbf!4v1451568322227" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
                                    </div>
                                    <dl>
                                        <dt>08 BP 11399 Ouagadougou 08,</dt>
                                        <dd>Quartier Patte - d'Oie,<br>
                                            Rue : 15.142, Porte : 98</dd>
                                        <dd><span>Mobile 1 : </span>+226 77 99 79 79</dd>
                                        <dd><span>Mobile 2 :    </span>+226 75 98 33 00</dd>
                                        <dd><span>E-mail: </span>afriqueabita@gmail.com</dd>
                                    </dl>
                                </div>
                                <div class="block-61">
                                    <h3><font color="#44a7bb">Formulaire de contact</font></h3>
                                    <form id="form" method="post" target="" action="contact.php" >
                                        <fieldset>
                                            <label for="nom_prenom"><strong>Nom et Prénom*</strong><input type="text" name="nom_prenom" id="nom_prenom" /></label>
                                            <label for="email"><strong>E-mail*</strong><input type="text" name="email" id="email" /></label></label>
                                            <label for="sujet"><strong>Sujet*</strong><input type="text" name="sujet" id="sujet" /></label></label>
                                            <label for="message"><strong>Message*</strong><textarea cols="70" rows="4" name="message" id="message"></textarea></br>
                                                <div class="btns"><input type="submit" value="Envoyer" /></div>
                                        </fieldset>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="clear"></div>
                    </div>
                </section>
            </div>
            <div class="aside"></section>
                <div class="container_12">
                    <div class="grid_12">
                        <div class="pad-2 wrap">
                            <h3 class="p5"><font color="#44a7bb">Nos Partenaires</font></h3>
                            <div class="wrap box-2">
                        	    <a href="#"><img src="images/banner-1.png" alt=""></a><a href="www.banqueatlantique.net"><img src="images/banner-2.png" alt=""></a><a href="#"><img src="images/banner-3.png" alt=""></a><a href="#"><img src="images/banner-4.png" alt=""></a><a href="#" class="last"><img src="images/banner-5.png" alt=""></a>
                            </div>
                        </div>
                    </div>
                    <div class="clear"> </div></div>

            </div>
            <!--==============================footer=================================-->
            <footer>
                <p>� 2016 Afrique Abita</p>
                <p>Copyright : MEDIATECH2000</p>
            </footer>
        </body>
    </html>
<?php } ?>

0