evaneo Posted February 6, 2009 Share Posted February 6, 2009 ok i have writtenthis simple form to email to me put i never recive the eamil any help please HTML CODE <html> <head> <style type="text/css"> <!-- .style3 { font-family: "Bell MT"; color: #FFFFFF; } --> </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Join Us Form</title> </head> <body bgcolor="#000000"> <form action="FormToEmail.php" method="post"> <table border="0" align="center" cellspacing="5" bgcolor="#000000"> <tr><td><span class="style3">Name</span></td> <td><input type="text" size="30" name="name"></td></tr> <tr><td><span class="style3">Email address</span></td> <td><input type="text" size="30" name="email"></td></tr> <tr><td><span class="style3">Age</span></td> <td><input type="text" size="30" name="age"></td></tr> <tr><td><span class="style3">IGN</span></td> <td><input type="text" size="30" name="ign"></td></tr> <tr><td><span class="style3">Link to Stats</span></td> <td><input type="text" size="30" name="stats"></td></tr> <tr><td><span class="style3">Xfire</span> </td> <td><input type="text" size="30" name="xfire"></td> </tr> <tr><td><span class="style3">Favourite Kit</span></td> <td><input type="text" size="30" name="favkit"></td></tr> <tr><td><span class="style3">Favourite Transport</span></td> <td><input type="text" size="30" name="favtrans"></td></tr> <tr><td><span class="style3">Read Rules</span></td><td> <input type="text" size="30" name="rules"></td></tr> <tr><td valign="top"><span class="style3">Comments</span></td> <td><textarea name="comments" rows="6" cols="30"></textarea></td></tr> <tr><td> </td> <td><input type="submit" value="Send"></tr> </table> </form> </body> </html> PHP CODE [<?php $my_email = "myemail@hotmail.com"; $continue = "/"; $errors = array(); // Remove $_COOKIE elements from $_REQUEST. if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}} // Validate email field. if(isset($_REQUEST['email']) && !empty($_REQUEST['email'])) { $_REQUEST['email'] = trim($_REQUEST['email']); if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}} } // Check referrer is from same site. if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";} // Check for a blank form. function recursive_array_check_blank($element_value) { global $set; if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}} else { foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);} } } recursive_array_check_blank($_REQUEST); if(!$set){$errors[] = "You cannot send a blank form";} unset($set); // Display any errors and exit if errors exist. if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;} if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");} // Build message. function build_message($request_input){if(!isset($message_output)){$message_output ="error";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");} $message = build_message($_REQUEST); $message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."Thank you for using FormToEmail from http://FormToEmail.com"; $message = stripslashes($message); $subject = "FormToEmail Comments"; $subject = stripslashes($subject); $from_name = ""; if(isset($_REQUEST['name']) && !empty($_REQUEST['name'])){$from_name = stripslashes($_REQUEST['name']);} $headers = "From: {$_REQUEST['email']}"; mail($my_email,$subject,$message,$headers); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Application Sent</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- .style1 {font-family: "Bell MT"} body { background-color: #000000; } .style2 {color: #000000} .style3 {font-family: "Bell MT"; color: #FFFFFF; } --> </style> </head> <body text="#FFFFFF"> <div> <center class="style2"> <p class="style3"><b>Thank you, <?php if(isset($_REQUEST['name'])){print stripslashes($_REQUEST['name']);} ?> </b> <br> Your Application Has Been Sent, Please Allow a few<br> days for admins to review it.</p> <p><a href="<?php print $continue; ?>" class="style1">Click here to continue</a></p> </center> </div> </body> </html>/code] Quote Link to comment https://forums.phpfreaks.com/topic/144096-not-sure-where-to-post-this-sorry-need-help-with-my-form/ Share on other sites More sharing options...
deadlyp99 Posted February 6, 2009 Share Posted February 6, 2009 Try something more simple to see if you can even do it from your server. If your doing it locally your isp needs to support it on their mail server, which they likely do not. http://us3.php.net/manual/en/function.mail.php Quote Link to comment https://forums.phpfreaks.com/topic/144096-not-sure-where-to-post-this-sorry-need-help-with-my-form/#findComment-756141 Share on other sites More sharing options...
haku Posted February 7, 2009 Share Posted February 7, 2009 Change this line: mail($my_email,$subject,$message,$headers); to this: mail($my_email,$subject,$message,$headers) ? die("mail_sent") : die("mail not sent"); And let me know what the output to your screen is. you can change your code back after doing that) Quote Link to comment https://forums.phpfreaks.com/topic/144096-not-sure-where-to-post-this-sorry-need-help-with-my-form/#findComment-756504 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.