Guest Posted January 23, 2012 Share Posted January 23, 2012 The attached code works except the email portion. This code allows a user to upload a file(s) to a network share & has a few check mark boxs for John Doe & Jane Doe. If the box for John or Jane is checked it is suppose to send them an email once submit is pressed but the email does not get sent. Can someone help me out on this? Thanks 17405_.txt Quote Link to comment https://forums.phpfreaks.com/topic/255597-php-email-code/ Share on other sites More sharing options...
Muddy_Funster Posted January 23, 2012 Share Posted January 23, 2012 you havn't really given us much to work with. Does mail() work at all form your site? have you tried assigning (join(', ', $destination) to a variable and then echoing it to make sure that the content is accurate? have you tried capturing any failure of mail() in that script? Quote Link to comment https://forums.phpfreaks.com/topic/255597-php-email-code/#findComment-1310338 Share on other sites More sharing options...
Guest Posted January 23, 2012 Share Posted January 23, 2012 I have some other .php scripts that generates email when the submit buttons are clicked & it works.....as far as the join variable...I'm new to php & not that advanced. Quote Link to comment https://forums.phpfreaks.com/topic/255597-php-email-code/#findComment-1310347 Share on other sites More sharing options...
Guest Posted January 23, 2012 Share Posted January 23, 2012 If I put just this code: <?php if (isset($_POST['formsent'])) { $destination = array(); if (!empty($_POST['notify_jane'])) $destination[] = [email protected]; if (!empty($_POST['notify_john'])) $destination[] = [email protected]; if ($destination) { mail(join(', ', $destination), 'Notification', 'Hey there'); } } else { ?> <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> <input type="hidden" name="formsent" value="true" /> <br/>Check this box <input autocomplete="off" type="checkbox" name="notify_jane" value="yes" /> to send <strong>John Doe</strong> a notification. <br/>Check this box <input autocomplete="off" type="checkbox" name="notify_john" value="yes" /> to send <strong>Jane Doe</strong> a notification. <input type="submit" value="Submit" /> </form> <?php } I still does not work & I get the URL below in the browser...thanks to any help provided. http://myserver/flow/%3C?=$_SERVER['PHP_SELF']?> Quote Link to comment https://forums.phpfreaks.com/topic/255597-php-email-code/#findComment-1310354 Share on other sites More sharing options...
Pikachu2000 Posted January 23, 2012 Share Posted January 23, 2012 Don't use short tags. Use <?php echo instead of <?=. And see the link in my signature regarding using $_SERVER['PHP_SELF']. Quote Link to comment https://forums.phpfreaks.com/topic/255597-php-email-code/#findComment-1310358 Share on other sites More sharing options...
Guest Posted January 23, 2012 Share Posted January 23, 2012 that fixed it thanks Quote Link to comment https://forums.phpfreaks.com/topic/255597-php-email-code/#findComment-1310361 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.