Call-911 Posted June 11, 2010 Share Posted June 11, 2010 Hello all, I have a PHP email script that works great, it sends an email to every user in my database. What I need is a way to display a message (preferably a little message pop up box) after the script is finished sending out it's emails. Right now the only way to tell it's done is thing's stop loading and at the bottom of Firefox it says it stops saying "Loading" and changes to "Done" Any advice? This seems simple enough, but I just can't seem to figure it out. Below is my script. <?php // Start a session session_start(); mysql_connect("localhost", "xxxxx", "xxxxxx") or die(mysql_error()); mysql_select_db("xxxxxxxxx") or die(mysql_error()); $id = $_POST['studentid']; $query="SELECT * FROM members"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $username=mysql_result($result,$i,"username"); $firstname=mysql_result($result,$i,"firstname"); $lastname=mysql_result($result,$i,"lastname"); $address=mysql_result($result,$i,"address"); $city=mysql_result($result,$i,"city"); $state=mysql_result($result,$i,"state"); $zip=mysql_result($result,$i,"zip"); $phone=mysql_result($result,$i,"phone"); $email=mysql_result($result,$i,"email"); $iba=mysql_result($result,$i,"iba"); $mbd=mysql_result($result,$i,"marchingband_currentdue"); $ctd=mysql_result($result,$i,"choir_currentdue"); $fd = popen("/usr/sbin/sendmail -t","w") or die("Couldn't Open Sendmail"); fputs($fd, "To: $email \n"); fputs($fd, "From: \"LWE Music\" <lwemusic@lwemusic.org> \n"); fputs($fd, "Subject: $firstname $lastname IBA \n"); fputs($fd, "X-Mailer: PHP3 \n\n"); fputs($fd, "To the parents of $firstname $lastname, This is your LWE Music IBA Statement. --------------------------------------------------------------------- Student Name: $firstname $lastname (Student ID: $id) Your current IBA is: $iba Your current Marching Band Fees are: $mbd Your current Choir Trip Fees are: $ctd --------------------------------------------------------------------- You can log into the Member Section by naviagting to lwemusic.org and click on Member Account Log In Any IBA Transfers can be completed online through the Member Section. For any questions about your IBA Balance or current fees, please contact the treasurer through the lwemusic.org Member Section. If you have forgotten your password, or do not know how to log in, please contact Eric Nush at enush@lw210.org Thank You, LWE Music \n"); pclose($fd); Echo "Emails sent to $email" ?> <br> <br> <?php ++$i; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/204497-after-query-display-message/ Share on other sites More sharing options...
jcbones Posted June 11, 2010 Share Posted June 11, 2010 At the very bottom, you can echo out a string. <?php ++$i; } echo 'Emails has been sent.'; ?> If you prefer a pop up box: <?php ++$i; } ?> <script type="text/javascript"> alert('Emails Sent!'); </script> Quote Link to comment https://forums.phpfreaks.com/topic/204497-after-query-display-message/#findComment-1070968 Share on other sites More sharing options...
3raser Posted June 11, 2010 Share Posted June 11, 2010 Why doesn't your echo have a colon? Echo "Emails sent to $email" Quote Link to comment https://forums.phpfreaks.com/topic/204497-after-query-display-message/#findComment-1070973 Share on other sites More sharing options...
Call-911 Posted June 12, 2010 Author Share Posted June 12, 2010 Perfect! Exactly what I needed. I knew it sounded simple, I just couldn't wrap my mind around it. Long day. And Justin, I added that semicolon for you. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/204497-after-query-display-message/#findComment-1070981 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.