Jump to content

[SOLVED] E-mail form help needed


Rowno

Recommended Posts

When I use the following script I made to try and make an e-mail form for a website I don't recieve any of the e-mails created by the script.

 

The HTML page:

 

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Untitled Document</title>

</head>

 

<body>

 

<form action="mail.php" method="post">

<table>

<tr>

<td align="left">

Your Name:

</td>

<td>

<input type="text" name="name">

</td>

</tr>

<tr>

<td align="left">

Your E-mail Address:

</td>

<td>

<input type="text" name="email">

</td>

</tr>

</table>

<p>

Message:

 

<textarea name="message" cols="38" rows="10"></textarea>

<p>

<input type="submit" value="Send">

</form>

 

</body>

</html>

 

 

The PHP page:

 

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Untitled Document</title>

</head>

 

<body>

 

<?

function checkOK($field)

{

if (eregi("\r",$field) || eregi("\n",$field)){

die("Invalid Input!");

}

}

 

$name = $_POST['name'];

checkOK($name);

$email = $_POST['email'];

checkOK($email);

$message = $_POST['message'];

checkOK($message);

$to = "my e-mail address here";

$emailmessage = "$name just filled in your e-mail form. They said:\n$message\n\nTheir e-mail address was: $email";

if (mail($to,"E-mail message from Halo 3 Archives",$emailmessage)) {

echo "Thanks for your input.

<a href=\"website url inserted here\">Back to main website.[/url]";

} else {

echo "There was a problem sending the e-mail. Please check that you filled in the form correctly";

}

?>

 

</body>

</html>

 

 

The IF statment comes out 'true' so I presume the e-mail is being sent but I never recieve the e-mails, does anyone know what could be the problem?

Link to comment
Share on other sites

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.