I need help debugging
sample site : http://www.testground.idghosting.com/mma/contact-mma.php
in english it's shows the "sent message" even if the form is not filled.. but in french (top right corner link) it doesn' show the fomr at all....
Here is my whole code :
<!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">À 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 évè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édia</a> | <a href="contact-mma.php?lang=fr">Contact</a><br />
© Association des marchands de la rue Monkland – Tous droits réservés<br />
<span>Site Web conçu par : Phil Communications - <a href="http://www.philcommunications.com" target="_blank">Dévoué 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>