begeiste Posted October 3, 2007 Share Posted October 3, 2007 hi, I have just created a email blast in the php along with a table subscribers in the photos database, and tested at http://localhost:8888/24/emailblast.php. Not sure why it didn't show me the result after I sendt the testing News letter to those email records which has been inserted into database table 'subscribers' from database 'photos'? Any inputs will be great appreciated!!! <?php if($_POST[op] !="send"){ //haven't seen the form, so show it echo " <html> <head> <title>Sending a Email blast</title> </head> <body> <h1>Send a News Letter</h1> <form method=\"post\" action=\"$_SERVER[php_SELF]\"> <p><b>Subject:</b><br> <input type=\"text\" name=\"subject\" size=30></p> <p><b>Mail body:</b><br> <textarea name=\"message\" cols=50 rows=10 wrap=virtual></textarea> <input type=\"hidden\" name=\"op\" vaule=\"send\"> <p><input type=\"submit\" name=\"submit\" value=\"Send It\"></p> </form> </body> </html>"; }else if ($_POST[op] == "send"){ //want to send form, so check for required fields if(($_POST[subject] =="") || ($_POST[message] == "")){ header("Location: emailblast.php"); exit; } //connect to database $conn = mysql_connect('localhost','root','root'); mysl_select_db('photos') or die(mysql_error()); //get emails from subscriber list $sql = "select email from subscribers"; $result = mysql_query($sql) or die(mysql_error()); //create a from: mailheader $headers = "From: Your Mailing List <[email protected]>"; //loop through results and send mail while($row = mysql_fetch_array($result)){ set_time_limit(0); $email = $row['email']; mail("$email", stripslashes($_POST[subject]),stripslashes($_POST[message]), $headers); echo "newsletter sent to: $email<br>"; } } ?> Link to comment https://forums.phpfreaks.com/topic/71627-email-question/ Share on other sites More sharing options...
hemlata Posted October 3, 2007 Share Posted October 3, 2007 Hello, Modify your code.. if($_POST[op] !="send"){ To .. if(!isset($_POST['submit'])){ and }else if ($_POST[op] == "send"){ to.. }else{ Hope this will solve your issue. Regards, Link to comment https://forums.phpfreaks.com/topic/71627-email-question/#findComment-360634 Share on other sites More sharing options...
begeiste Posted October 3, 2007 Author Share Posted October 3, 2007 Thanks a lot. Link to comment https://forums.phpfreaks.com/topic/71627-email-question/#findComment-361127 Share on other sites More sharing options...
darkfreaks Posted October 3, 2007 Share Posted October 3, 2007 please click topic solved if this has helped Link to comment https://forums.phpfreaks.com/topic/71627-email-question/#findComment-361132 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.