garnett21 Posted August 26, 2007 Share Posted August 26, 2007 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"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/66774-formmail-issues/ Share on other sites More sharing options...
Jessica Posted August 26, 2007 Share Posted August 26, 2007 A blank page with no errors could mean you don't have error reporting turned on. Add this to the top of your pages: ini_set('display_errors', 1); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/66774-formmail-issues/#findComment-334590 Share on other sites More sharing options...
garnett21 Posted August 26, 2007 Author Share Posted August 26, 2007 I put that code into both pages (and of course added <?php ?> on the original html page to insert that code), and still get a blank page. Quote Link to comment https://forums.phpfreaks.com/topic/66774-formmail-issues/#findComment-334595 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.