topflight Posted February 3, 2009 Share Posted February 3, 2009 May somebody please tell me why this script is not working. All I am trying to do is create a simple email script. <?php if(isset($_POST['submit'])){ $ip = $_SERVER['REMOTE_ADDR']; $name = $_POST['aname']; $aemail = $_POST['aemail']; $amessage = $_POST['amessage']; $email = '//my email here'; if((!$name) || (!$aemail) || (!$amessage) || (!$asubject)){?> <script>javascript:alert("<?php if(!$name){ echo"No Name!"; } if(!$aemail){ echo"No Email Address!"; if(!$asubject){ echo"<br />No Subject!<br /><br />"; if(!$amessage){ echo"No message!";?>")</script> <?php } else { mail($email, $subject, $message, "From:$aemail" . phpversion());?> <script>window.location="contactus?page=mainc";</script> <style type="text/css"> <!-- .style6 {font-size: 12px} --> </style> <?php } } } } } ?> thanks in advanced Quote Link to comment https://forums.phpfreaks.com/topic/143563-solved-not-emailing/ Share on other sites More sharing options...
ratcateme Posted February 3, 2009 Share Posted February 3, 2009 i am guessing there is lots of code above it? for all the }'s at the bottom? there doesn't look to be anything wrong Scott. Quote Link to comment https://forums.phpfreaks.com/topic/143563-solved-not-emailing/#findComment-753268 Share on other sites More sharing options...
topflight Posted February 3, 2009 Author Share Posted February 3, 2009 Well do you think I should delete some of the "}"? Because it is still not working. Quote Link to comment https://forums.phpfreaks.com/topic/143563-solved-not-emailing/#findComment-753271 Share on other sites More sharing options...
ratcateme Posted February 3, 2009 Share Posted February 3, 2009 ye well they will be causing syntax errors check you php.ini and make error_reporting = E_ALL Scott. Quote Link to comment https://forums.phpfreaks.com/topic/143563-solved-not-emailing/#findComment-753278 Share on other sites More sharing options...
topflight Posted February 3, 2009 Author Share Posted February 3, 2009 Well I deleted 2 } and I got an $end error so I added some back until the error went away. here is my code now: <?php if(isset($_POST['submit'])){ $ip = $_SERVER['REMOTE_ADDR']; $name = $_POST['aname']; $aemail = $_POST['aemail']; $amessage = $_POST['amessage']; $email = '//my email here'; if((!$name) || (!$aemail) || (!$amessage) || (!$asubject)){?> <script>javascript:alert("<?php if(!$name){ echo"No Name!"; } if(!$aemail){ echo"No Email Address!"; if(!$asubject){ echo"<br />No Subject!<br /><br />"; if(!$amessage){ echo"No message!";?>")</script> <? } else { mail($email, $subject, $message, "From:$aemail" . phpversion());?> <script>window.location="contactus?page=mainc";</script> <style type="text/css"> <!-- .style6 {font-size: 12px} --> </style> <?php } } } }} ?> Quote Link to comment https://forums.phpfreaks.com/topic/143563-solved-not-emailing/#findComment-753286 Share on other sites More sharing options...
ratcateme Posted February 3, 2009 Share Posted February 3, 2009 well i am guessing that the code that is above it is controlling it. and stopping it from working. Scott. Quote Link to comment https://forums.phpfreaks.com/topic/143563-solved-not-emailing/#findComment-753290 Share on other sites More sharing options...
topflight Posted February 3, 2009 Author Share Posted February 3, 2009 so do anybody know what I should do? Quote Link to comment https://forums.phpfreaks.com/topic/143563-solved-not-emailing/#findComment-753293 Share on other sites More sharing options...
ratcateme Posted February 3, 2009 Share Posted February 3, 2009 WHAT CODE IS ABOVE IT???????????? if you need more }'s at the bottom then there must be code above it and it is proberly the reason it is not working!!!!! Scott. Quote Link to comment https://forums.phpfreaks.com/topic/143563-solved-not-emailing/#findComment-753296 Share on other sites More sharing options...
topflight Posted February 3, 2009 Author Share Posted February 3, 2009 nothing Quote Link to comment https://forums.phpfreaks.com/topic/143563-solved-not-emailing/#findComment-753297 Share on other sites More sharing options...
topflight Posted February 3, 2009 Author Share Posted February 3, 2009 I got it to work I had the curly brackets in the wrong place thanks. Quote Link to comment https://forums.phpfreaks.com/topic/143563-solved-not-emailing/#findComment-753300 Share on other sites More sharing options...
killah Posted February 3, 2009 Share Posted February 3, 2009 I got it to work I had the curly brackets in the wrong place thanks. I actualy noticed that when i first saw the first page. But since it's solved. Good luck. Quote Link to comment https://forums.phpfreaks.com/topic/143563-solved-not-emailing/#findComment-753301 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.