updwebmaster Posted December 18, 2007 Share Posted December 18, 2007 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? Quote Link to comment Share on other sites More sharing options...
trq Posted December 18, 2007 Share Posted December 18, 2007 For starters, the email address you specify needs to be in quotes. Its meant to be a string. $to = "uberpilotdudes@bellsouth.net,$email"; Turn on error_reporting, I'm sure there are many more. Quote Link to comment Share on other sites More sharing options...
updwebmaster Posted December 18, 2007 Author Share Posted December 18, 2007 Thanks. I got rid of the error emailing and I put quotes around the $to variable, but it still won't work properly... Quote Link to comment Share on other sites More sharing options...
chigley Posted December 18, 2007 Share Posted December 18, 2007 Why not turn error reporting back on and have a look at the remaining errors? Quote Link to comment Share on other sites More sharing options...
updwebmaster Posted December 18, 2007 Author Share Posted December 18, 2007 where do you see the errors? The webpage goes white and doesn't show anything when it loads... Quote Link to comment Share on other sites More sharing options...
chigley Posted December 18, 2007 Share Posted December 18, 2007 <?php error_reporting(E_ALL); ?> Stick that at the top of your PHP file. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 18, 2007 Share Posted December 18, 2007 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. Quote Link to comment Share on other sites More sharing options...
updwebmaster Posted December 18, 2007 Author Share Posted December 18, 2007 wow. ok I'll take a look. All I wanted was for someone too look at my code to tell me what went wrong... If you guys want to view the form, it's here: http://www.uberpilotdudes.com/application_for_battle.htm . you can go ahead and submit some random form info if you want. It won't go through is the problem... Quote Link to comment Share on other sites More sharing options...
chigley Posted December 18, 2007 Share Posted December 18, 2007 Have you inserted the error_reporting() line I showed you? Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted December 18, 2007 Share Posted December 18, 2007 The screen goes white it means the php parser crashed. So error reporting won't work - Quote Link to comment Share on other sites More sharing options...
helraizer Posted December 18, 2007 Share Posted December 18, 2007 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 Quote Link to comment Share on other sites More sharing options...
updwebmaster Posted December 18, 2007 Author Share Posted December 18, 2007 ok the error reporting didn't work... what now? Quote Link to comment Share on other sites More sharing options...
chigley Posted December 18, 2007 Share Posted December 18, 2007 Look in your server error log. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 18, 2007 Share Posted December 18, 2007 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. Quote Link to comment Share on other sites More sharing options...
chigley Posted December 18, 2007 Share Posted December 18, 2007 On a quick look at the code, I can see dozens of simple errors. I'd suggest you either start from scratch, or go through it line by line. Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted December 18, 2007 Share Posted December 18, 2007 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. Quote Link to comment Share on other sites More sharing options...
helraizer Posted December 18, 2007 Share Posted December 18, 2007 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. @ 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 Quote Link to comment Share on other sites More sharing options...
Wolphie Posted December 19, 2007 Share Posted December 19, 2007 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. Quote Link to comment 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.