Jump to content

FormMail issues


garnett21

Recommended Posts

I was working on a formail php script to collect email addresses for a contact page.  My site is hosted by crystaltech.com, on an IIS server.  After submitting the form, my browser (IE7) goes to a blank screen, and nothing happens (nor do I ever receive any email).  Thanks for any help that can be provided.

Here's the code for the actual form page (phptest.html)

<html>

<body>

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

<b>Nickname:</b><br />

<input type="text" name="nickname" value="Your name/nickname" /><br /><br />

<b>E-mail:</b><br />

<input type="text" name="email" value="Your E-mail" /><br /><br />

<b>Message:</b><br />

<textarea name="message" rows="5" cols="50"></textarea><br />

<input type="hidden" name="ip" value="<? echo $REMOTE_ADDR; ?>" />

<input name="Submit" type="submit" value="Submit" />

<input name="Submit" type="reset" value="Reset" />

</form>

</body>

</html>

and here's the code for nvform.php

<?php

// The error message if there are one or more fields not filled in

$error = "There are some fields not filled in, <a href="javascript:history.go(-1)">click here to go back</a>";

 

// Let's check if all fields are filled in!

if($nickname == "" || $message == "" || $email == ""){

// Lets echo that error! ;)

  echo $error;

}

 

// Let's do a small IP check..

elseif($ip == ""){

  echo "Sorry, an unknow error has occuredn";

}

 

/*

  if after all everything is filled in correct, lets start doing the mailscript...

  Edit the variable's below to make them fit your needs

*/

else{

$yourwebsite = "http://www.bettersexbetterdating.com"; // Your website

$recipientname = "Sam Williford"; // Whats your name ?!

$subject="Test";  // The subject of the mail thats being sended

$recipient="[email protected]"; // the recipient

 

/*

  The headers for the e-mail, no need to change it unless you know what you're doing

*/

$header = "From: $nickname <$email>rn";

$header .= "MIME-Version: 1.0rn";

$header .= "Content-Type: text/html; charset=iso-8859-1rn";

$header .= "X-Priority: 3rn";

$header .= "X-MSMail-Priority: Normalrn";

$header .= "X-Mailer: PHP / ".phpversion()."rn";

 

/*

  You can change the text below to whatever you wish to have

  for the way the mail is gonne be outputted, you can use HTML!

*/

$content= "Dear $recipientname, $nickname has sended you an e-mail from $yourwebsite.<br /><b>Message:</b>$message<hr noshade="true" size="1" color="#000000" />You can contact $nickname back at $email.";

mail($recipient, $content, $header);

echo "Thanks! Your e-mail has been sended succesfull $nickname. We will contact you back on $email ASAP";

}

?>

Link to comment
https://forums.phpfreaks.com/topic/66774-formmail-issues/
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.