PHP的奇怪故障

时间:2009-08-07 14:32:11

标签: php syntax-error

我需要帮助调试

示例网站:http://www.testground.idghosting.com/mma/contact-mma.php

用英语显示“发送的消息”,即使表格没有填写..但是在法语(右上角链接)中它根本没有显示出来......

以下是我的全部代码:

    <!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 = 'laurence@idgc.ca';
//$to = 'info@villagemonkland.org';


//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:info@villagemonkland.org">info@villagemonkland.org</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:info@villagemonkland.org">info@villagemonkland.org</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>

4 个答案:

答案 0 :(得分:1)

错误意味着编译器(解释器)遇到了在当前上下文中没有意义的符号。使用标准样式if的地方是在第130行,它使用大括号而不是if的替代形式。所以,在第130行改变:

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

 if ($_SERVER['REQUEST_METHOD'] != 'POST') :
如果你感兴趣的话,BTW这个神秘的信息实际上来自Bison。

还有其他一些翻转标准if和elseifs。这是编译良好的完整代码:

<!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 = 'laurence@idgc.ca';
$to = 'info@villagemonkland.org';


//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:info@villagemonkland.org">info@villagemonkland.org</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:info@villagemonkland.org">info@villagemonkland.org</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>

答案 1 :(得分:0)

您必须先加}结束if ($_SERVER['REQUEST_METHOD'] != 'POST'){才能结束英语if

这样的事情:

<!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 = 'laurence@idgc.ca';
$to = 'info@villagemonkland.org';


//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:info@villagemonkland.org">info@villagemonkland.org</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:info@villagemonkland.org">info@villagemonkland.org</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>

因为if语句是嵌套的,所以它希望结束最近打开的if语句,因此它需要一个紧密的括号,因为这是你打开的方式。当它看到endif时,它会说“那不是最近的用途”和错误。

答案 2 :(得分:0)

尝试替换

<?php endif; //end english

<?php }; //end english

答案 3 :(得分:0)

你必须替换

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

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