hey im doing this site with a contact me form and i coded a function to test everything but when im running it just sends a mail with nothing whithout cheking it ;S
here is the my function file
and here are the html with the form
hope you can help me thanks
...
here is the my function file
PHP Code:
<?php
$msg;
$post = $_POST['post'];
function mailer($to,$from,$message,$hidden,$subject){
global $msg;
global $post;
if(!empty($post)){
if(!empty($hidden)) {
$sendit = 0;
$msg = "<p style=\"background-color:red;text-align:center;\">BIIIGGG FAIL! GET OFF ****ING SPAM MACHINE</p>";
}
else{
if(empty($to) || empty($from) || empty($message)){
$msg ="<p style=\"background-color:red;text-align:center;\">Please fill out all fields</p>";
$sendit = 0;
}
else{
$sendit = 1;
}
}
}
if($send=1){
$headers = "From: \"".$from."\" <".$from.">\n";
$headers .= "To: \"".$to."\" <".$to.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/HTML; charset=ISO-8859-1\n";
if(mail($to, $subject, $message, $headers)){
$msg ="<p style=\"background-color:green;text-align:center;\">Thanks for your message ;)</p>";
}
else{
$msg ="<p style=\"background-color:red;text-align:center;\">Something went wrong might me the mail serverplease try again later</p>";
}
}
}
?>
PHP Code:
<?php require("class_lib.php"); ?>
<?php
mailer("[email protected]",$_POST['cemail'],$_POST['cmessage'],$_POST['chidden'],"Contact me form");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Hmail | BETA - Contact</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<!-- header start -->
<div id="header">
<a href="http://hmail.servegame.org/home">
<img src="images/logo.jpg" style="width:280px; height:122px;" alt="logo" /></a>
</div>
<!-- header end -->
<!-- wrapper start -->
<div id="wrapper">
<!-- menu start -->
<div id="menu">
<h2>Navigation</h2>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="about.php">About me</a></li>
<li><a href="contact.php">Contact me</a></li>
</ul>
<h2>Login</h2>
<form method="post" action="#">
<label>Username:</label>
<input type="text" name="username" class="txtBox" />
<label>Password:</label>
<input type="password" name="password" class="txtBox" />
<a href="register.php">Not a member yet??</a>
<input type="submit" name="go" value="Go" class="go" />
</form>
</div>
<!-- menu end -->
<!-- content start -->
<div id="content">
<h2>Contact me</h2>
<?php echo $msg; ?>
<p>Hey just fill it out and send it ;)</p>
<form method="post" target="<?php echo "$_phpself()"; ?>" id="contact">
<input type="text" name="chidden" class="hidden" >
<span>Name:</span>
<input type="text" name="cname" class="ctxtBox">
<span>Email:</span>
<input type="text" name="cemail" class="ctxtBox">
<span>Message</span>
<textarea class="ctxtarea" name="cmessage"> </textarea>
<input type="submit" value="Send">
<input type="text" name="post" value="posted" class="hidden" >
</form>
</div>
<!-- content end -->
<!-- footer start -->
<div id="footer">
<p>© 2009 <a href="http://hmail.servegame.org/home">Hmail.servegame.org</a> | All rights reserved.</p>
</div>
<!-- footer end -->
</div>
<!-- wrapper end -->
</body>
</html>

Comment