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="SamWilliford@gmail.com"; // 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
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.