Jump to content

White Screen with mailing code


updwebmaster

Recommended Posts

I have a custom mailing code and I can't figure out what's wrong. Here's the code:

<?php
if(isset($_POST['frm_action1']) && $_POST['frm_action1']==1)
{


$sender = "Uberpilotdudes.com";
$name = $_POST['Name'];
$date = $_POST['Date'];
$tags = $_POST['Tags'];
$oemail = $_POST['other_emails'];
$email = $_POST['Email'];
$today = date("l, F j, Y, g:i a") ;
$to = uberpilotdudes@bellsouth.net,$email
$body ="Submitted on: $today<br/>
Name: $name<br/>
Tags: $tags<br/>
When: $date<br/>
E-Mail: $email<br/>
Other E-mails: $oemail";

mail($to,"Application for Battle",$body,$sender);
$message = "The application has been sent successfully!<br/><br/><SCRIPT LANGUAGE="JavaScript">
<!--
window.setTimeout('CountDown()',100);
-->
</SCRIPT><FORM NAME="form1">
        <div class="style1">
          You are being redirected in
          <input type="text" name="clock" size="2" value="5" />
          seconds.
        </div>
      </FORM>";
}
else
{ 
$error = "There was an error sending the Application for Joining! Check the coding!";
mail(uberpilotdudes@bellsouth.net,"Error!",$error,$sender)
$message = "There was an error when sending the application! Please send your application information to our webmaster at: uberpilotdudes@bellsouth.net<br/>Please click <b><a href="../home.htm">HERE</a></b> to return to the UPD homepage. Sorry!";
}

?>
<html xmlns="http://www.w3.org/1999/xhtml">

  <head>
    <script language="javascript">
      <!-- Original:  Corey (638@gohip.com ) -->
      <!-- Web Site:   http://six38.tripod.com -->
      <!-- This script and many more are available free online at -->
      <!-- The JavaScript Source!! http://javascript.internet.com -->
      <!-- Begin
var start=new Date();
start=Date.parse(start)/1000;
var counts=10;
function CountDown(){
	var now=new Date();
	now=Date.parse(now)/1000;
	var x=parseInt(counts-(now-start),10);
	if(document.form1){document.form1.clock.value = x;}
	if(x>0){
		timerID=setTimeout("CountDown()", 100)
	}else{
		location.href="../home.htm"
	}
}
//  End -->
</script>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>App for Battle Confirm</title>
<script type="text/javascript">
<!--
function FP_goToURL(url) {//v1.0
window.location=url;
}
// -->
</script>
<style type="text/css">
.style1 {
text-align: center;
}
</style>
</head>

<body style="color: #FFFFFF; background-color: #000000">

  <div class="style1">

    <center>
      <?php echo $message ?><br />
    </center>
  </div>
</body>

</html>

When I go to submit the form, all I get is a white screen. What's the problem?

Link to comment
Share on other sites

Fatal parse errors, of the type the code has, won't be shown by turning on error reporting in the file, because the code will never be executed when there is a parse error.

 

Check your web server log for errors or turn on full php error reporting in php.ini or a .htaccess file.

Link to comment
Share on other sites

Fatal parse errors, of the type the code has, won't be shown by turning on error reporting in the file, because the code will never be executed when there is a parse error.

 

Check your web server log for errors or turn on full php error reporting in php.ini or a .htaccess file.

 

Add

 


<?php

error_reporting(E_ALL);

ini_set('display_errors', true);

?>

 

This will show all types of errors, including fatal errors.

 

Sam

 

Link to comment
Share on other sites

We are not here to debug the php syntax errors in your code, one at a time. It will take you are very long time to produce any working code if you are relying on a forum to find your syntax errors.

 

So, no. No one here is going to look through your code and tell you what when wrong until you have code that at least executes.

 

Edit: Since those two lines of code in the file will never be executed when there is a parse error, error reporting won't be turned on by them.

Link to comment
Share on other sites

There is a debate on:

 

error reporting vs. not using it

 

YOU CAN NOT use error reporting in this situation. The parser crashed and when somethings crashes it surely won't give you errors - unless its a microsoft product.

 

Being a microsoft product is probably what caused it to crash. ;):P

 

@ the OP.

 

Change

$message = "The application has been sent successfully!<br/><br/><SCRIPT LANGUAGE="JavaScript">
<!--
window.setTimeout('CountDown()',100);
-->
</SCRIPT><FORM NAME="form1">
        <div class="style1">
          You are being redirected in
          <input type="text" name="clock" size="2" value="5" />
          seconds.
        </div>
      </FORM>";

To

$message = "The application has been sent successfully!<br/><br/><SCRIPT LANGUAGE='JavaScript'>
<!--
window.setTimeout('CountDown()',100);
-->
</SCRIPT><FORM NAME='form1'>
        <div class='style1'>
          You are being redirected in
          <input type='text' name='clock' size='2' value='5' />
          seconds.
        </div>
      </FORM>";

 

Then change

 

mail(uberpilotdudes@bellsouth.net,"Error!",$error,$sender)
$message = "There was an error when sending the application! Please send your application information to our webmaster at: uberpilotdudes@bellsouth.net<br/>Please click <b><a href="../home.htm">HERE</a></b> to return to the UPD homepage. Sorry!";

 

To

mail("uberpilotdudes@bellsouth.net","Error!",$error,$sender);
$message = "There was an error when sending the application! Please send your application information to our webmaster at: uberpilotdudes@bellsouth.net<br/>Please click <b><a href='../home.htm'>HERE</a></b> to return to the UPD homepage. Sorry!";

 

After that, there are no more immediate errors. See if it works.

 

Sam

Link to comment
Share on other sites

This is how i'd generally write a client contact form:

 

<?php
error_reporting(E_ALL);
ini_set('display_errors', true);

switch($_GET['do'])
{
  default:
   $form = '<form method="post" action="?do=send">';
   $form .= '<table cellpadding="0" cellspacing="0">';
   $form .= '<tr><td>Your Email:<input type="text" name="email" /></td></tr>';
   $form .= '<tr><td>Subject: <input type="text" name="subject" /></td></tr>';
   $form .= '<tr><td>Message: <textarea cols="5" rows="10" name="message"></textarea></tr></tr>';
   $form .= '<tr><td><input type="submit" value="Send" /></td></tr>';
   $form .= '</table>';
   $form .= '</form>';
  break;

  case 'send':
   $to = 'youremail@domain.com';
   $from = 'From: ' . $_POST['email'];
   $subject = $_POST['subject'];
   $message = $_POST['message'];
   mail($to, $subject, $message, $from);
  break;
}
?>

 

Change that around a bit and you should be fine.

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.