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
https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.