Jump to content

posted in html put im sure its a PHP thing MY FORM WONT WORK


Recommended Posts

ok i have written this simple form to email to me but i never recieve the email 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>

 

 

sorry if posted wrong im new to this whole post HERE thing and didnt know where to post this

Do you get any errors?

 

Have you checked that your conditional statements are processing correctly. You have a lot of if statements. Get the script to print to the screen where you expect a condition to pass as to test.

 

Are you on windows or linux?

 

Have you checked the server mail log?

 

Is you mail server running correctly?

 

Can you send an email from the server directly? If not there maybe DNS issues.

 

etc.....

 

no errors come

statments are processing right

up im on windows

mail server log is empty

mail server fine (works for other mails etc)

i can mail direct from server

i checked almost everything i could think of thats why i can here LOL

Is your php.ini file setup correctly in terms of SMTP entry. Write a small script that just sends an email using mail() just to make sure its not your code on this page.

Take an example from: http://uk3.php.net/manual/en/book.mail.php

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.