2009-08-07 11 views
0

je besoin d'aide débogagepépin bizarre avec PHP

exemple de site

: http://www.testground.idghosting.com/mma/contact-mma.php

en anglais, il est montre le « message envoyé » même si le formulaire est pas rempli .. mais en français (lien en haut à droite) il n » montre la fomr du tout ....

Voici mon code tout:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 

<?php 

//============== 
//CONFIGURATION 
//============== 

//IMPORTANT!! 
//Put in your email address below: 
$to = '[email protected]'; 
//$to = '[email protected]'; 


//User info (DO NOT EDIT!) 
$name = stripslashes($_POST['name']); //sender's name 
$email = stripslashes($_POST['email']); //sender's email 
$website = stripslashes($_POST['website']); //sender's website 

//The subject 
//$subject = "[LightFormX Contact Form] "; //The default subject. Will appear by default in all messages. Change this if you want. 
$subject .= stripslashes($_POST['subject']); // the subject 


//The message you will receive in your mailbox 
//Each parts are commented to help you understand what it does exaclty. 
//YOU DON'T NEED TO EDIT IT BELOW BUT IF YOU DO, DO IT WITH CAUTION! 
$msg = "From : $name \r\n"; //add sender's name to the message 
$msg .= "e-Mail : $email \r\n"; //add sender's email to the message 
$msg .= "Website : $website \r\n"; //add sender's website to the message 
$msg .= "Subject : $subject \r\n\n"; //add subject to the message (optional! It will be displayed in the header anyway) 
$msg .= "---Message--- \r\n".stripslashes($_POST['message'])."\r\n\n"; //the message itself 

?> 

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<meta name="Author" content="Merchant Monkland Associations" /> 
<meta name="copyright" content="Merchant Monkland Associations" /> 
<meta name="Description" content="The Monkland Merchant Association Contact form & Information " /> 
<meta name="Keywords" content="monkland village, monkland avenue, montreal, NDG, restaurants, video store, shops, mma, boutiques, mma media, SDC monkland, contact monkland" /> 
<title>The Monkland Merchant Association – Contact form & Information </title> 
<link href="<?php 
if($lang=='en' || $lang==''): 

echo('style.css'); 
endif; 

if($lang=='fr'): 

echo('style-fr.css'); 
endif; 
?>" rel="stylesheet" type="text/css" media="all" /> 

<script type="text/javascript" src="js/mootools.js"></script> 

<!-- Formcheck2/Moo.Floor.ch --> 
<!-- http://moo.floor.ch/?p=18 --> 
<script type="text/javascript" src="js/formcheck.js"></script> 
<script type="text/javascript"> 
    window.addEvent('domready', function(){check = new FormCheck('third', { 
     display : { 
       fadeDuration : 500, 
       errorsLocation : 1, 
       indicateErrors : 1, 
       showErrors : 1 
     } 
    })}); 
</script> 

<!-- NiceForms/BadBoy.ro --> 
<!-- http://www.badboy.ro/articles/2005-07-23/niceforms_preview/ --> 
<script type="text/javascript" src="js/niceforms.js"></script> 

</style> 

</head> 
<body id="Contact"> 
<!--START WRAPPER--> 
<div id="wrapper"> 
<!--LOGO--> 
<div id="logo"><a href="index.php"><img src="<?php 
if($lang=='en' || $lang==''): 

echo('images/mma-logo.jpg'); 
endif; 

if($lang=='fr'): 

echo('images/mma-logo-fr.jpg'); 
endif; 
?>" border="0" /></a></div> 
<!--END LOGO--> 
<?php 
if($lang=='en' || $lang==''): 

include('include/Top_Menu.php'); 
endif; 

if($lang=='fr'): 

include('include/Top_Menu-fr.php'); 
endif; 
?> 
<!--MAIN MENU--> 
<?php 
if($lang=='en' || $lang==''): 

include('include/M_menu.php'); 
endif; 

if($lang=='fr'): 

include('include/M_menu-fr.php'); 
endif; 
?> 
<!--END MENU--> 
<div id="contactBanner"> 
<?php //include ('include/MemberSubmenu.php');?> 
</div> 
<!--RIGHT BOX--> 
<?php 
if($lang=='en' || $lang==''): 

include('include/About-R_box.php'); 
endif; 

if($lang=='fr'): 

include('include/About-R_box-fr.php'); 
endif; 
?> 
<!--END RIGHT BOX--> 
<?php if ($lang=='' || $lang=='en'): ?> 

<div id="ContentBody"> 
<h2>Contact us</h2> 
<p><h3 class="blue">Monkland Merchant Association</h3> 
<a href="mailto:[email protected]">[email protected]</a><br /> 
514-658-8909</p> 

<p><h3 class="blue">Mailing address:</h3> 
1751 Richardson, #8.135<br /> 
Montreal, Quebec H3K 1G6 </p> 

<h3 class="blue">Via E-mail:</h3> 
<!-- The contact form starts here--> 
<?php 
    if ($_SERVER['REQUEST_METHOD'] != 'POST') : 
     $self = $_SERVER['PHP_SELF']; 
?> 

    <!-- Start HTML form --> 
    <form name="form" method="post" id="third" action="<?php echo $self;?>" class="niceform"> 
     <!-- Name --> 
     <label for="name"><strong><span class="blue">*</span> Name : </strong></label> 
       <input id="name" name="name" type="text" class="validate['required','length[3,-1]','nodigit']" size="20" /> 

     <!-- Email --> 
     <label for="email"><strong><span class="blue">*</span> Email : </strong></label> 
       <input id="email" name="email" type="text" class="validate['required','length[5,-1]','email']" size="20" /> 

     <!-- Website --> 
     <label for="site">Website : </label> 
       <input id="website" name="website" type="text" class="validate['url']" size="20" /> 

     <!-- Subject --> 
     <label for="subject"><strong><span class="blue">*</span> Subject : </strong></label> 
       <input id="subject" name="subject" type="text" class="validate['required']" size="20" /> 

     <!-- Message --> 
     <label for="msg"><strong><span class="blue">*</span> Your message : </strong></label><br /> 
       <textarea id="message" name="message" type="text" class="validate['required']" rows="10" cols="30"></textarea> 

     <!-- Spam Check --> 
     <label for="spamcheck"><span class="blue">*</span> <acronym title="[ Spam prevention ]"><strong>Are you human?</strong></acronym> : <span class="blue"><strong>2 + 3 = ???</span></strong></label> 
       <input id="spamcheck" name="spamcheck" type="text" size="5" class="validate['required','number','spamcheck']" /> 

     <br /><br /> 
     <input type="submit" class="buttonSubmit" value="Send it!" /> 

     <!-- Niceforms: mouse over effect --> 
     <!-- Do not remove the line below --> 
     <div id="stylesheetTest"></div> 

    </form> 

</div> 


<?php endif; //end english 

/* 
******************************************* 
**************** FRENCH ****************** 
******************************************* 
*/ 

if($lang=='fr'): ?> 


<div id="ContentBody"> 
<h2>Pour nous joindre</h2> 
<p><h3 class="blue">Association des marchands de la rue Monkland</h3> 
<a href="mailto:[email protected]">[email protected]</a><br /> 
514-658-8909</p> 

<p><h3 class="blue">Adresse postale :</h3> 
1751, rue Richardson, bureau 8.135<br /> 
Montréal (Québec) H3K 1G6 </p> 

<h3 class="blue">Via E-mail:</h3> 
<!-- The contact form starts here--> 
<?php 
    if ($_SERVER['REQUEST_METHOD'] != 'POST'): 
     $self = $_SERVER['PHP_SELF']; 
?> 

    <!-- Start HTML form --> 
    <form name="form" method="post" id="third" action="<?php echo $self;?>" class="niceform"> 
     <!-- Name --> 
     <label for="name"><strong><span class="blue">*</span> Nom : </strong></label> 
       <input id="name" name="name" type="text" class="validate['required','length[3,-1]','nodigit']" size="20" /> 

     <!-- Email --> 
     <label for="email"><strong><span class="blue">*</span> Courriel : </strong></label> 
       <input id="email" name="email" type="text" class="validate['required','length[5,-1]','email']" size="20" /> 

     <!-- Website --> 
     <label for="site">Site Web : </label> 
       <input id="website" name="website" type="text" class="validate['url']" size="20" /> 

     <!-- Subject --> 
     <label for="subject"><strong><span class="blue">*</span> Objet : </strong></label> 
       <input id="subject" name="subject" type="text" class="validate['required']" size="20" /> 

     <!-- Message --> 
     <label for="msg"><strong><span class="blue">*</span> Votre message : </strong></label><br /> 
       <textarea id="message" name="message" type="text" class="validate['required']" rows="10" cols="30"></textarea> 

     <!-- Spam Check --> 
     <label for="spamcheck"><span class="blue">*</span> <acronym title="[ Spam prevention ]"><strong>Ëtes-vous un robot?</strong></acronym> : <span class="blue"><strong>2 + 3 = ???</span></strong></label> 
       <input id="spamcheck" name="spamcheck" type="text" size="5" class="validate['required','number','spamcheck']" /> 

     <br /><br /> 
     <input type="submit" class="buttonSubmit" value="Envoyez!" /> 

     <!-- Niceforms: mouse over effect --> 
     <!-- Do not remove the line below --> 
     <div id="stylesheetTest"></div> 

    </form> 

</div> 
<?php endif; // end french ?> 

<?php 
if($lang=='en' || $lang==''): 

echo ('<div class="clr"></div> 
<div id="footerNav"> 
<a href="index.php">Home</a> | <a href="mission-mma.php">About us</a> | <a href="our-village-mma.php">Our village</a> | <a href="our-services-mma.php">Our services</a> | <a href="our-events-mma.php">Our events</a> | <a href="our-members-mma.php">Our members</a> | <a href="faq-mma.php">FAQ</a> | <a href="press-mma.php">Press</a> | <a href="contact-mma.php">Contact us</a><br /> 
Copyright Monkland Merchant Association - All rights managed<br /> 
<span>Website design by : Phil Communications - <a href="http://www.philcommunications.com" target="_blank">Non-profit spealists</a></span> 
</div> 
</div> '); 
endif; 

if($lang=='fr'): 

echo ('<div class="clr"></div> 
<div id="footerNav"> 
<a href="index-fr.php?lang=fr">Accueil</a> | <a href="mission-mma.php?lang=fr">&Agrave; propos</a> | <a href="our-village-mma.php?lang=fr">Notre village</a> | <a href="our-services-mma.php?lang=fr">Nos services</a> | <a href="our-events-mma.php?lang=fr">Nos &eacute;v&egrave;nements</a> | <a href="our-members-mma.php?lang=fr">Nos membres</a> | <a href="faq-mma.php?lang=fr">FAQ</a> | <a href="press-mma.php?lang=fr">M&eacute;dia</a> | <a href="contact-mma.php?lang=fr">Contact</a><br /> 
&copy; Association des marchands de la rue Monkland &ndash; Tous droits r&eacute;serv&eacute;s<br /> 
<span>Site Web con&ccedil;u par : Phil Communications - <a href="http://www.philcommunications.com" target="_blank">D&eacute;vou&eacute; aux organismes communautaires et sociaux </a></span> 
</div> 
</div>'); 
endif; 
?> 

<!--/footer --> 


<?php 
    else: 
     error_reporting(0); 

     if (mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n")) 

     //Message sent! 
     //It the message that will be displayed when the user click the sumbit button 
     //You can modify the text if you want 
     echo nl2br(" 
     <div class=\"MsgSent\"> 
       <h1>Congratulations!!</h1> 
       <p>Thank you <b>$name</b>, your message is sent!<br /> We will get back to you as soon as possible.</p> 
     </div> 
     "); 

     else 

     // Display error message if the message failed to send 
     echo " 
     <div class=\"MsgError\"> 
       <h1>Error!!</h1> 
       <p>Sorry <b><?=$name;?></b>, your message failed to send. Try later!</p> 
     </div>"; 

     endif; 

    endif; 

?> 

</body> 
</html> 
+0

Quelle est la ligne 172? – Dirk

+0

Vous devriez envisager d'utiliser des modèles. – Gumbo

+0

Salut Gumbo J'utilise un template php ... pour toutes les pages sauf pour cette page de contact .. ça jsut ne fonctionnera pas à l'intérieur du template .. –

Répondre

0

Vous devez mettre dans un } pour mettre fin à la if ($_SERVER['REQUEST_METHOD'] != 'POST'){ avant de pouvoir mettre fin à l'anglais if

donc quelque chose comme ceci:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 

<?php 

//============== 
//CONFIGURATION 
//============== 

//IMPORTANT!! 
//Put in your email address below: 
//$to = '[email protected]'; 
$to = '[email protected]'; 


//User info (DO NOT EDIT!) 
$name = stripslashes($_POST['name']); //sender's name 
$email = stripslashes($_POST['email']); //sender's email 
$website = stripslashes($_POST['website']); //sender's website 

//The subject 
//$subject = "[LightFormX Contact Form] "; //The default subject. Will appear by default in all messages. Change this if you want. 
$subject .= stripslashes($_POST['subject']); // the subject 


//The message you will receive in your mailbox 
//Each parts are commented to help you understand what it does exaclty. 
//YOU DON'T NEED TO EDIT IT BELOW BUT IF YOU DO, DO IT WITH CAUTION! 
$msg = "From : $name \r\n"; //add sender's name to the message 
$msg .= "e-Mail : $email \r\n"; //add sender's email to the message 
$msg .= "Website : $website \r\n"; //add sender's website to the message 
$msg .= "Subject : $subject \r\n\n"; //add subject to the message (optional! It will be displayed in the header anyway) 
$msg .= "---Message--- \r\n".stripslashes($_POST['message'])."\r\n\n"; //the message itself 

?> 

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<meta name="Author" content="Merchant Monkland Associations" /> 
<meta name="copyright" content="Merchant Monkland Associations" /> 
<meta name="Description" content="The Monkland Merchant Association Contact form & Information " /> 
<meta name="Keywords" content="monkland village, monkland avenue, montreal, NDG, restaurants, video store, shops, mma, boutiques, mma media, SDC monkland, contact monkland" /> 
<title>The Monkland Merchant Association – Contact form & Information </title> 
<link rel="stylesheet" href="style.css" type="text/css" media="screen" /> 

<script type="text/javascript" src="js/mootools.js"></script> 

<!-- Formcheck2/Moo.Floor.ch --> 
<!-- http://moo.floor.ch/?p=18 --> 
<script type="text/javascript" src="js/formcheck.js"></script> 
<script type="text/javascript"> 
    window.addEvent('domready', function(){check = new FormCheck('third', { 
     display : { 
       fadeDuration : 500, 
       errorsLocation : 1, 
       indicateErrors : 1, 
       showErrors : 1 
     } 
    })}); 
</script> 

<!-- NiceForms/BadBoy.ro --> 
<!-- http://www.badboy.ro/articles/2005-07-23/niceforms_preview/ --> 
<script type="text/javascript" src="js/niceforms.js"></script> 

</style> 

</head> 
<body id="Contact"> 
<!--START WRAPPER--> 
<div id="wrapper"> 
<!--LOGO--> 
<div id="logo"><a href="index.php"><img src="images/mma-logo.jpg" width="215" height="143" border="0" /></a></div> 
<!--END LOGO--> 
<?php 
if($lang=='en' || $lang==''): 

include('include/Top_Menu.php'); 
endif; 

if($lang=='fr'): 

include('include/Top_Menu-fr.php'); 
endif; 
?> 
<!--MAIN MENU--> 
<?php 
if($lang=='en' || $lang==''): 

include('include/M_menu.php'); 
endif; 

if($lang=='fr'): 

include('include/M_menu-fr.php'); 
endif; 
?> 
<!--END MENU--> 
<div id="contactBanner"> 
<?php //include ('include/MemberSubmenu.php');?> 
</div> 
<!--RIGHT BOX--> 
<?php 
if($lang=='en' || $lang==''): 

include('include/About-R_box.php'); 
endif; 

if($lang=='fr'): 

include('include/About-R_box-fr.php'); 
endif; 
?> 
<!--END RIGHT BOX--> 
<?php if ($lang=='' || $lang=='en'): ?> 

<div id="ContentBody"> 
<h2>Contact us</h2> 
<p><h3 class="blue">Monkland Merchant Association</h3> 
<a href="mailto:[email protected]">[email protected]</a><br /> 
514-658-8909</p> 

<p><h3 class="blue">Mailing address:</h3> 
1751 Richardson, #8.135<br /> 
Montreal, Quebec H3K 1G6 </p> 

<h3 class="blue">Via E-mail:</h3> 
<!-- The contact form starts here--> 
<?php 
    if ($_SERVER['REQUEST_METHOD'] != 'POST'){ 
     $self = $_SERVER['PHP_SELF']; 
?> 

    <!-- Start HTML form --> 
    <form name="form" method="post" id="third" action="<?php echo $self;?>" class="niceform"> 
     <!-- Name --> 
     <label for="name"><strong><span class="blue">*</span> Name : </strong></label> 
       <input id="name" name="name" type="text" class="validate['required','length[3,-1]','nodigit']" size="20" /> 

     <!-- Email --> 
     <label for="email"><strong><span class="blue">*</span> Email : </strong></label> 
       <input id="email" name="email" type="text" class="validate['required','length[5,-1]','email']" size="20" /> 

     <!-- Website --> 
     <label for="site">Website : </label> 
       <input id="website" name="website" type="text" class="validate['url']" size="20" /> 

     <!-- Subject --> 
     <label for="subject"><strong><span class="blue">*</span> Subject : </strong></label> 
       <input id="subject" name="subject" type="text" class="validate['required']" size="20" /> 

     <!-- Message --> 
     <label for="msg"><strong><span class="blue">*</span> Your message : </strong></label><br /> 
       <textarea id="message" name="message" type="text" class="validate['required']" rows="10" cols="30"></textarea> 

     <!-- Spam Check --> 
     <label for="spamcheck"><span class="blue">*</span> <acronym title="[ Spam prevention ]"><strong>Are you human?</strong></acronym> : <span class="blue"><strong>2 + 3 = ???</span></strong></label> 
       <input id="spamcheck" name="spamcheck" type="text" size="5" class="validate['required','number','spamcheck']" /> 

     <br /><br /> 
     <input type="submit" class="buttonSubmit" value="Send it!" /> 

     <!-- Niceforms: mouse over effect --> 
     <!-- Do not remove the line below --> 
     <div id="stylesheetTest"></div> 

    </form> 

</div> 


<?php endif; //end english 

/* 
******************************************* 
**************** FRENCH ****************** 
******************************************* 
*/ 

if($lang=='fr'): ?> 


<div id="ContentBody"> 
<h2>Pour nous joindre</h2> 
<p><h3 class="blue">Association des marchands de la rue Monkland</h3> 
<a href="mailto:[email protected]">[email protected]</a><br /> 
514-658-8909</p> 

<p><h3 class="blue">Adresse postale :</h3> 
1751, rue Richardson, bureau 8.135<br /> 
Montréal (Québec) H3K 1G6 </p> 

<h3 class="blue">Via E-mail:</h3> 
<!-- The contact form starts here--> 
<?php 
    if ($_SERVER['REQUEST_METHOD'] != 'POST'){ 
     $self = $_SERVER['PHP_SELF']; 
?> 

    <!-- Start HTML form --> 
    <form name="form" method="post" id="third" action="<?php echo $self;?>" class="niceform"> 
     <!-- Name --> 
     <label for="name"><strong><span class="blue">*</span> Nom : </strong></label> 
       <input id="name" name="name" type="text" class="validate['required','length[3,-1]','nodigit']" size="20" /> 

     <!-- Email --> 
     <label for="email"><strong><span class="blue">*</span> Courriel : </strong></label> 
       <input id="email" name="email" type="text" class="validate['required','length[5,-1]','email']" size="20" /> 

     <!-- Website --> 
     <label for="site">Site Web : </label> 
       <input id="website" name="website" type="text" class="validate['url']" size="20" /> 

     <!-- Subject --> 
     <label for="subject"><strong><span class="blue">*</span> Objet : </strong></label> 
       <input id="subject" name="subject" type="text" class="validate['required']" size="20" /> 

     <!-- Message --> 
     <label for="msg"><strong><span class="blue">*</span> Votre message : </strong></label><br /> 
       <textarea id="message" name="message" type="text" class="validate['required']" rows="10" cols="30"></textarea> 

     <!-- Spam Check --> 
     <label for="spamcheck"><span class="blue">*</span> <acronym title="[ Spam prevention ]"><strong>Ëtes-vous un robot?</strong></acronym> : <span class="blue"><strong>2 + 3 = ???</span></strong></label> 
       <input id="spamcheck" name="spamcheck" type="text" size="5" class="validate['required','number','spamcheck']" /> 

     <br /><br /> 
     <input type="submit" class="buttonSubmit" value="Envoyez!" /> 

     <!-- Niceforms: mouse over effect --> 
     <!-- Do not remove the line below --> 
     <div id="stylesheetTest"></div> 

    </form> 

</div> 
<?php } 
endif; // end french ?> 

<?php 
if($lang=='en' || $lang==''): 

echo ('<div class="clr"></div> 
<div id="footerNav"> 
<a href="index.php">Home</a> | <a href="mission-mma.php">About us</a> | <a href="our-village-mma.php">Our village</a> | <a href="our-services-mma.php">Our services</a> | <a href="our-events-mma.php">Our events</a> | <a href="our-members-mma.php">Our members</a> | <a href="faq-mma.php">FAQ</a> | <a href="press-mma.php">Press</a> | <a href="contact-mma.php">Contact us</a><br /> 
Copyright Monkland Merchant Association - All rights managed<br /> 
<span>Website design by : Phil Communications - <a href="http://www.philcommunications.com" target="_blank">Non-profit spealists</a></span> 
</div> 
</div> '); 
endif; 

if($lang=='fr'): 

echo ('<div class="clr"></div> 
<div id="footerNav"> 
<a href="index-fr.php?lang=fr">Accueil</a> | <a href="mission-mma.php?lang=fr">&Agrave; propos</a> | <a href="our-village-mma.php?lang=fr">Notre village</a> | <a href="our-services-mma.php?lang=fr">Nos services</a> | <a href="our-events-mma.php?lang=fr">Nos &eacute;v&egrave;nements</a> | <a href="our-members-mma.php?lang=fr">Nos membres</a> | <a href="faq-mma.php?lang=fr">FAQ</a> | <a href="press-mma.php?lang=fr">M&eacute;dia</a> | <a href="contact-mma.php?lang=fr">Contact</a><br /> 
&copy; Association des marchands de la rue Monkland &ndash; Tous droits r&eacute;serv&eacute;s<br /> 
<span>Site Web con&ccedil;u par : Phil Communications - <a href="http://www.philcommunications.com" target="_blank">D&eacute;vou&eacute; aux organismes communautaires et sociaux </a></span> 
</div> 
</div>'); 
endif; 
?> 

<!--/footer --> 


<?php 
    } else { 
     error_reporting(0); 

     if (mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n")) 

     //Message sent! 
     //It the message that will be displayed when the user click the sumbit button 
     //You can modify the text if you want 
     echo nl2br(" 
     <div class=\"MsgSent\"> 
       <h1>Congratulations!!</h1> 
       <p>Thank you <b>$name</b>, your message is sent!<br /> We will get back to you as soon as possible.</p> 
     </div> 
     "); 

     else 

     // Display error message if the message failed to send 
     echo " 
     <div class=\"MsgError\"> 
       <h1>Error!!</h1> 
       <p>Sorry <b><?=$name;?></b>, your message failed to send. Try later!</p> 
     </div>"; 
    } 
?> 

</body> 
</html> 

Parce que l'instruction if est imbriqué, il veut mettre fin à la plus récemment ouverte si la déclaration, il attend un support de proximité parce que c'est ainsi que tu as ouvert. Quand il voit le endif, il dit "Ce n'est pas ce qui est le plus récent s'il utilise", et les erreurs.

+0

je savais que j'avais l'erreur " Erreur d'analyse: erreur de syntaxe, inattendu '}' dans /home/idghosti/public_html/testground/mma/contact-mma.php à la ligne 268 " –

+0

La même chose s'est produite dans la version française. –

+0

Vous devez donc corriger les deux versions en ajoutant un '}' –

0

essayez de remplacer

<?php endif; //end english 

avec

<?php }; //end english 
+0

Est assez bon aussi, pourquoi le négatif? – inakiabt

+0

S'il le faisait, l'anglais 'if' se chevaucherait avec le français, provoquant des problèmes –

1

L'erreur signifie que le compilateur (interprète) a rencontré un symbole qui n'a pas de sens dans le contexte actuel. Le seul endroit où le style standard if est utilisé est la ligne 130, où il utilise des accolades au lieu de la forme alternative de if. Ainsi, sur la ligne 130 changement:

if ($_SERVER['REQUEST_METHOD'] != 'POST'){ 

à

if ($_SERVER['REQUEST_METHOD'] != 'POST') : 

BTW le message cryptique provient en fait de Bison, si vous êtes intéressé.

Il existe plusieurs autres if et else standard inversés. Voici le code complet qui compile bien:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 

<?php 

//============== 
//CONFIGURATION 
//============== 

//IMPORTANT!! 
//Put in your email address below: 
//$to = '[email protected]'; 
$to = '[email protected]'; 


//User info (DO NOT EDIT!) 
$name = stripslashes($_POST['name']); //sender's name 
$email = stripslashes($_POST['email']); //sender's email 
$website = stripslashes($_POST['website']); //sender's website 

//The subject 
//$subject = "[LightFormX Contact Form] "; //The default subject. Will appear by default in all messages. Change this if you want. 
$subject .= stripslashes($_POST['subject']); // the subject 


//The message you will receive in your mailbox 
//Each parts are commented to help you understand what it does exaclty. 
//YOU DON'T NEED TO EDIT IT BELOW BUT IF YOU DO, DO IT WITH CAUTION! 
$msg = "From : $name \r\n"; //add sender's name to the message 
$msg .= "e-Mail : $email \r\n"; //add sender's email to the message 
$msg .= "Website : $website \r\n"; //add sender's website to the message 
$msg .= "Subject : $subject \r\n\n"; //add subject to the message (optional! It will be displayed in the header anyway) 
$msg .= "---Message--- \r\n".stripslashes($_POST['message'])."\r\n\n"; //the message itself 

?> 

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<meta name="Author" content="Merchant Monkland Associations" /> 
<meta name="copyright" content="Merchant Monkland Associations" /> 
<meta name="Description" content="The Monkland Merchant Association Contact form & Information " /> 
<meta name="Keywords" content="monkland village, monkland avenue, montreal, NDG, restaurants, video store, shops, mma, boutiques, mma media, SDC monkland, contact monkland" /> 
<title>The Monkland Merchant Association – Contact form & Information </title> 
<link rel="stylesheet" href="style.css" type="text/css" media="screen" /> 

<script type="text/javascript" src="js/mootools.js"></script> 

<!-- Formcheck2/Moo.Floor.ch --> 
<!-- http://moo.floor.ch/?p=18 --> 
<script type="text/javascript" src="js/formcheck.js"></script> 
<script type="text/javascript"> 
    window.addEvent('domready', function(){check = new FormCheck('third', { 
     display : { 
       fadeDuration : 500, 
       errorsLocation : 1, 
       indicateErrors : 1, 
       showErrors : 1 
     } 
    })}); 
</script> 

<!-- NiceForms/BadBoy.ro --> 
<!-- http://www.badboy.ro/articles/2005-07-23/niceforms_preview/ --> 
<script type="text/javascript" src="js/niceforms.js"></script> 

</style> 

</head> 
<body id="Contact"> 
<!--START WRAPPER--> 
<div id="wrapper"> 
<!--LOGO--> 
<div id="logo"><a href="index.php"><img src="images/mma-logo.jpg" width="215" height="143" border="0" /></a></div> 
<!--END LOGO--> 
<?php 
if($lang=='en' || $lang==''): 

include('include/Top_Menu.php'); 
endif; 

if($lang=='fr'): 

include('include/Top_Menu-fr.php'); 
endif; 
?> 
<!--MAIN MENU--> 
<?php 
if($lang=='en' || $lang==''): 

include('include/M_menu.php'); 
endif; 

if($lang=='fr'): 

include('include/M_menu-fr.php'); 
endif; 
?> 
<!--END MENU--> 
<div id="contactBanner"> 
<?php //include ('include/MemberSubmenu.php');?> 
</div> 
<!--RIGHT BOX--> 
<?php 
if($lang=='en' || $lang==''): 

include('include/About-R_box.php'); 
endif; 

if($lang=='fr'): 

include('include/About-R_box-fr.php'); 
endif; 
?> 
<!--END RIGHT BOX--> 
<?php if ($lang=='' || $lang=='en'): ?> 

<div id="ContentBody"> 
<h2>Contact us</h2> 
<p><h3 class="blue">Monkland Merchant Association</h3> 
<a href="mailto:[email protected]">[email protected]</a><br /> 
514-658-8909</p> 

<p><h3 class="blue">Mailing address:</h3> 
1751 Richardson, #8.135<br /> 
Montreal, Quebec H3K 1G6 </p> 

<h3 class="blue">Via E-mail:</h3> 
<!-- The contact form starts here--> 
<?php 
    if ($_SERVER['REQUEST_METHOD'] != 'POST') : 
     $self = $_SERVER['PHP_SELF']; 
?> 

    <!-- Start HTML form --> 
    <form name="form" method="post" id="third" action="<?php echo $self;?>" class="niceform"> 
     <!-- Name --> 
     <label for="name"><strong><span class="blue">*</span> Name : </strong></label> 
       <input id="name" name="name" type="text" class="validate['required','length[3,-1]','nodigit']" size="20" /> 

     <!-- Email --> 
     <label for="email"><strong><span class="blue">*</span> Email : </strong></label> 
       <input id="email" name="email" type="text" class="validate['required','length[5,-1]','email']" size="20" /> 

     <!-- Website --> 
     <label for="site">Website : </label> 
       <input id="website" name="website" type="text" class="validate['url']" size="20" /> 

     <!-- Subject --> 
     <label for="subject"><strong><span class="blue">*</span> Subject : </strong></label> 
       <input id="subject" name="subject" type="text" class="validate['required']" size="20" /> 

     <!-- Message --> 
     <label for="msg"><strong><span class="blue">*</span> Your message : </strong></label><br /> 
       <textarea id="message" name="message" type="text" class="validate['required']" rows="10" cols="30"></textarea> 

     <!-- Spam Check --> 
     <label for="spamcheck"><span class="blue">*</span> <acronym title="[ Spam prevention ]"><strong>Are you human?</strong></acronym> : <span class="blue"><strong>2 + 3 = ???</span></strong></label> 
       <input id="spamcheck" name="spamcheck" type="text" size="5" class="validate['required','number','spamcheck']" /> 

     <br /><br /> 
     <input type="submit" class="buttonSubmit" value="Send it!" /> 

     <!-- Niceforms: mouse over effect --> 
     <!-- Do not remove the line below --> 
     <div id="stylesheetTest"></div> 

    </form> 

</div> 


<?php endif; //end english 

/* 
******************************************* 
**************** FRENCH ****************** 
******************************************* 
*/ 

if($lang=='fr'): ?> 


<div id="ContentBody"> 
<h2>Pour nous joindre</h2> 
<p><h3 class="blue">Association des marchands de la rue Monkland</h3> 
<a href="mailto:[email protected]">[email protected]</a><br /> 
514-658-8909</p> 

<p><h3 class="blue">Adresse postale :</h3> 
1751, rue Richardson, bureau 8.135<br /> 
Montréal (Québec) H3K 1G6 </p> 

<h3 class="blue">Via E-mail:</h3> 
<!-- The contact form starts here--> 
<?php 
    if ($_SERVER['REQUEST_METHOD'] != 'POST'): 
     $self = $_SERVER['PHP_SELF']; 
?> 

    <!-- Start HTML form --> 
    <form name="form" method="post" id="third" action="<?php echo $self;?>" class="niceform"> 
     <!-- Name --> 
     <label for="name"><strong><span class="blue">*</span> Nom : </strong></label> 
       <input id="name" name="name" type="text" class="validate['required','length[3,-1]','nodigit']" size="20" /> 

     <!-- Email --> 
     <label for="email"><strong><span class="blue">*</span> Courriel : </strong></label> 
       <input id="email" name="email" type="text" class="validate['required','length[5,-1]','email']" size="20" /> 

     <!-- Website --> 
     <label for="site">Site Web : </label> 
       <input id="website" name="website" type="text" class="validate['url']" size="20" /> 

     <!-- Subject --> 
     <label for="subject"><strong><span class="blue">*</span> Objet : </strong></label> 
       <input id="subject" name="subject" type="text" class="validate['required']" size="20" /> 

     <!-- Message --> 
     <label for="msg"><strong><span class="blue">*</span> Votre message : </strong></label><br /> 
       <textarea id="message" name="message" type="text" class="validate['required']" rows="10" cols="30"></textarea> 

     <!-- Spam Check --> 
     <label for="spamcheck"><span class="blue">*</span> <acronym title="[ Spam prevention ]"><strong>Ëtes-vous un robot?</strong></acronym> : <span class="blue"><strong>2 + 3 = ???</span></strong></label> 
       <input id="spamcheck" name="spamcheck" type="text" size="5" class="validate['required','number','spamcheck']" /> 

     <br /><br /> 
     <input type="submit" class="buttonSubmit" value="Envoyez!" /> 

     <!-- Niceforms: mouse over effect --> 
     <!-- Do not remove the line below --> 
     <div id="stylesheetTest"></div> 

    </form> 

</div> 
<?php endif; // end french ?> 

<?php 
if($lang=='en' || $lang==''): 

echo ('<div class="clr"></div> 
<div id="footerNav"> 
<a href="index.php">Home</a> | <a href="mission-mma.php">About us</a> | <a href="our-village-mma.php">Our village</a> | <a href="our-services-mma.php">Our services</a> | <a href="our-events-mma.php">Our events</a> | <a href="our-members-mma.php">Our members</a> | <a href="faq-mma.php">FAQ</a> | <a href="press-mma.php">Press</a> | <a href="contact-mma.php">Contact us</a><br /> 
Copyright Monkland Merchant Association - All rights managed<br /> 
<span>Website design by : Phil Communications - <a href="http://www.philcommunications.com" target="_blank">Non-profit spealists</a></span> 
</div> 
</div> '); 
endif; 

if($lang=='fr'): 

echo ('<div class="clr"></div> 
<div id="footerNav"> 
<a href="index-fr.php?lang=fr">Accueil</a> | <a href="mission-mma.php?lang=fr">&Agrave; propos</a> | <a href="our-village-mma.php?lang=fr">Notre village</a> | <a href="our-services-mma.php?lang=fr">Nos services</a> | <a href="our-events-mma.php?lang=fr">Nos &eacute;v&egrave;nements</a> | <a href="our-members-mma.php?lang=fr">Nos membres</a> | <a href="faq-mma.php?lang=fr">FAQ</a> | <a href="press-mma.php?lang=fr">M&eacute;dia</a> | <a href="contact-mma.php?lang=fr">Contact</a><br /> 
&copy; Association des marchands de la rue Monkland &ndash; Tous droits r&eacute;serv&eacute;s<br /> 
<span>Site Web con&ccedil;u par : Phil Communications - <a href="http://www.philcommunications.com" target="_blank">D&eacute;vou&eacute; aux organismes communautaires et sociaux </a></span> 
</div> 
</div>'); 
endif; 
?> 

<!--/footer --> 


<?php 
    else: 
     error_reporting(0); 

     if (mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n")) 

     //Message sent! 
     //It the message that will be displayed when the user click the sumbit button 
     //You can modify the text if you want 
     echo nl2br(" 
     <div class=\"MsgSent\"> 
       <h1>Congratulations!!</h1> 
       <p>Thank you <b>$name</b>, your message is sent!<br /> We will get back to you as soon as possible.</p> 
     </div> 
     "); 

     else 

     // Display error message if the message failed to send 
     echo " 
     <div class=\"MsgError\"> 
       <h1>Error!!</h1> 
       <p>Sorry <b><?=$name;?></b>, your message failed to send. Try later!</p> 
     </div>"; 

     endif; 

    endif; 

?> 

</body> 
</html> 
+0

ce travail mais mon formulaire en français ne s'affiche pas .... –

+0

Je viens de le vérifier pour la syntaxe, pas pour la logique. Le problème avec la forme alternative est que cela rend très difficile la détermination de la logique, en particulier avec le manque d'indentation. Peut-être que si vous passez au style standard, alors vous pouvez comprendre pourquoi cela échoue. –

+0

J'ai mis à jour mon message ....... s'il vous plaît aider .... –

0

vous devez remplacer

<?php 
    if ($_SERVER['REQUEST_METHOD'] != 'POST'){ 

avec

<?php 
    if ($_SERVER['REQUEST_METHOD'] != 'POST'):