pixeltrace Posted April 8, 2007 Share Posted April 8, 2007 guys, i need help, i have a emailer sender form which is meant to send to either, indivual, per group or entire email list in my database. my problem now, its now working and i am getting some error messages which i cannot fix. the error message is Parse error: parse error, unexpected $end in c:\hosting\webhost4life\member\diorgrace\admean\email\blast.php on line 173 this is the code for my page <? session_start(); if (session_is_registered("username")){ include("../db_connect.php"); if (!isset($_POST['submit'])): ?> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6" align="left"><img src="../images/spacer.gif" width="6" height="10" /></td> <td width="100%"><form method="post" action="<?=$_SERVER['PHP_SELF']?>"> <table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> <td width="214" valign="top"><table width="558" border="0" cellspacing="2" cellpadding="3"> <tr> <td colspan="3" valign="top"><img src="images/spacer.gif" width="10" height="1" /></td> </tr> <tr> <td colspan="3" bgcolor="#999999" class="text2">SEND EMAIL ALERTS </td> </tr> <tr> <td colspan="3" valign="top" class="text7"> </td> </tr> <tr> <td width="119" align="right" valign="top" class="text6">send by :</td> <td> </td> <td width="412" class="text7"> <select name="to"> <option selected value="all">Entire list</option> <option value="notall">Specialization</option> <option value="peremail">Individual Email</option> </select> </select></td> </tr> <tr> <td align="right"><span class="text6">by specialization : </span></td> <td> </td> <td><select name="specialization"> <option value="" selected="selected">-- select specialization here --</option> <? $uSql = "SELECT specialization FROM specialization"; $uResult = mysql_query($uSql, $connection); if(!$uResult){ echo 'no data found'; }else{ while($uRow = mysql_fetch_array($uResult)){ ?> <option value="<?= $uRow[specialization]?>"> <?= $uRow[specialization]?> </option> <? } } ?> </select></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if by specialization, please select one here </td> </tr> <tr> <td align="right">per email : </td> <td> </td> <td><span class="text7"> <input name="peremail" type="text" class="textfield" maxlength="100" size="40" /> </span></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if per email, please input the email address here </td> </tr> <tr> <td align="right"><span class="text6">subject :</span></td> <td> </td> <td><span class="text7"> <input name="subject" type="text" class="textfield" maxlength=100 size=40> </span></td> </tr> <tr> <td align="right" valign="top" class="text6"> </td> <td align="right" valign="top" class="text6"> </td> <td valign="top" class="text7"> </td> </tr> <tr> <td colspan="3" valign="top" class="text6"><hr></td> </tr> <tr> <td colspan="3" valign="top" class="text6">HTML BODY: copy & paste the HTML page here <span class="text7"></span> </td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><textarea id="elm1" name="message" rows="35" cols="80" style="width: 100%"></textarea></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><input type="submit" name="submit" value="Add Candidate" class="textfield1" /> <input type=hidden value=http://www. name=redirect></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"> </td> </tr> </table></td> <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> </table> </form></td> <td width="6" align="right"><img src="../images/spacer.gif" width="6" height="10" /></td> </tr> </table> <?php else: $to = $_POST['to']; $subject = $_POST['subject']; $message = $_POST['message']; $specialization = $_POST['specialization']; if ("all" == $to) { $x = 1; $hold = 50; // quantity of emails sent before 3 sec delay $emails = mysql_query("SELECT email FROM applicant WHERE subscribe = 'yes'"); while ($sendemail = mysql_fetch_array($emails)) { $email = $sendemail["email"]; mail($email, $subject, $message, "From:JobHiRings <posmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop } elseif ("notall" == $to) { $byspecialization = mysql_query("SELECT email FROM applicant WHERE specialization = '$specialization' AND subscribe = 'yes'"); while ($countmail = mysql_fetch_array($byspecialization)) { $email = $countmail["email"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop } elseif ("peremail" == $to) { $email = $_POST["peremail"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop ?> <? }else{ echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='../index.php'>Login</a></font>"; } ?> hope you could help me with this. thanks! Quote Link to comment Share on other sites More sharing options...
per1os Posted April 8, 2007 Share Posted April 8, 2007 Your first if statement does not have { } around it, try adding those as anything that displays more than one line or processes mroe than one line in an if require the { }. When you get the parse error $end it generally means you are not closing a { } somewhere. Quote Link to comment Share on other sites More sharing options...
pixeltrace Posted April 8, 2007 Author Share Posted April 8, 2007 hi, its still not working. could you help me fix the error? thanks! Quote Link to comment Share on other sites More sharing options...
pixeltrace Posted April 8, 2007 Author Share Posted April 8, 2007 hi, i dont see the errors now, but when i try sending an email here to my email address. i dont receive any emails hope you could help me fix the error below is my codes for this page <? include("db_connect.php"); if (!isset($_POST['submit'])): ?> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6" align="left"><img src="../images/spacer.gif" width="6" height="10" /></td> <td width="100%"><form method="post" action="<?=$_SERVER['PHP_SELF']?>"> <table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> <td width="214" valign="top"><table width="558" border="0" cellspacing="2" cellpadding="3"> <tr> <td colspan="3" valign="top"><img src="images/spacer.gif" width="10" height="1" /></td> </tr> <tr> <td colspan="3" bgcolor="#999999" class="text2">SEND EMAIL ALERTS </td> </tr> <tr> <td colspan="3" valign="top" class="text7"> </td> </tr> <tr> <td width="119" align="right" valign="top" class="text6">send by :</td> <td> </td> <td width="412" class="text7"> <select name="to" class="textfield1"> <option selected value="all">Entire list</option> <option value="notall">Specialization</option> <option value="peremail">Individual Email</option> </select> </select></td> </tr> <tr> <td align="right"><span class="text6">by specialization : </span></td> <td> </td> <td><select name="specialization" class="textfield1"> <option value="" selected="selected">-- select specialization here --</option> <? $uSql = "SELECT specialization FROM specialization"; $uResult = mysql_query($uSql, $connection); if(!$uResult){ echo 'no data found'; }else{ while($uRow = mysql_fetch_array($uResult)){ ?> <option value="<?= $uRow[specialization]?>"> <?= $uRow[specialization]?> </option> <? } } ?> </select></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if by specialization, please select one here </td> </tr> <tr> <td align="right"><span class="text6">per email :</span> </td> <td> </td> <td><span class="text7"> <input name="peremail" type="text" class="textfield" maxlength="100" size="40" /> </span></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if per email, please input the email address here </td> </tr> <tr> <td align="right"><span class="text6">subject :</span></td> <td> </td> <td><span class="text7"> <input name="subject" type="text" class="textfield" maxlength=100 size=40> </span></td> </tr> <tr> <td align="right" valign="top" class="text6"> </td> <td align="right" valign="top" class="text6"> </td> <td valign="top" class="text7"> </td> </tr> <tr> <td colspan="3" valign="top" class="text6"><hr></td> </tr> <tr> <td colspan="3" valign="top" class="text6">HTML BODY: copy & paste the HTML page here <span class="text7"></span> </td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><textarea id="elm1" name="message" rows="35" cols="80" style="width: 100%"></textarea></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><input type="submit" name="submit" value="send" class="textfield1" /> <input type=hidden value=http://www. name=redirect></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"> </td> </tr> </table></td> <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> </table> </form></td> <td width="6" align="right"><img src="../images/spacer.gif" width="6" height="10" /></td> </tr> </table> <?php else: $to = $_POST['to']; $subject = $_POST['subject']; $message = $_POST['message']; $specialization = $_POST['specialization']; if ("all" == $to) { $x = 1; $hold = 50; // quantity of emails sent before 3 sec delay $emails = mysql_query("SELECT email FROM applicant WHERE subscribe = 'yes'"); while ($sendemail = mysql_fetch_array($emails)) { $email = $sendemail["email"]; mail($email, $subject, $message, "From:JobHiRings <posmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop } elseif ("notall" == $to) { $byspecialization = mysql_query("SELECT email FROM applicant WHERE specialization = '$specialization' AND subscribe = 'yes'"); while ($countmail = mysql_fetch_array($byspecialization)) { $email = $countmail["email"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop } elseif ("peremail" == $to) { $email = $_POST["peremail"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop } ?> <?php endif; ?> thanks! Quote Link to comment Share on other sites More sharing options...
pixeltrace Posted April 9, 2007 Author Share Posted April 9, 2007 any help for this please? thanks! Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 9, 2007 Share Posted April 9, 2007 you need to sort out the IF statements as they don't make sence! Quote Link to comment Share on other sites More sharing options...
pixeltrace Posted April 9, 2007 Author Share Posted April 9, 2007 can you help me sort it, since i honestly dont know how to do it, the codes where just given to me and the sender never came back to me again. thanks! Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 9, 2007 Share Posted April 9, 2007 OK try this let me know what problems exist i cleaned it up a but <?php include("db_connect.php"); if ( !isset($_POST['submit']) ) { ?> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6" align="left"><img src="../images/spacer.gif" width="6" height="10" /></td> <td width="100%"><form method="post" action="<?=$_SERVER['PHP_SELF']?>"> <table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> <td width="214" valign="top"><table width="558" border="0" cellspacing="2" cellpadding="3"> <tr> <td colspan="3" valign="top"><img src="images/spacer.gif" width="10" height="1" /></td> </tr> <tr> <td colspan="3" bgcolor="#999999" class="text2">SEND EMAIL ALERTS </td> </tr> <tr> <td colspan="3" valign="top" class="text7"> </td> </tr> <tr> <td width="119" align="right" valign="top" class="text6">send by :</td> <td> </td> <td width="412" class="text7"> <select name="to" class="textfield1"> <option selected value="all">Entire list</option> <option value="notall">Specialization</option> <option value="peremail">Individual Email</option> </select> </select></td> </tr> <tr> <td align="right"><span class="text6">by specialization : </span></td> <td> </td> <td><select name="specialization" class="textfield1"> <option value="" selected="selected">-- select specialization here --</option> <?php $uSql = "SELECT specialization FROM specialization"; $uResult = mysql_query($uSql, $connection); if(!$uResult){ echo 'no data found'; }else{ while($uRow = mysql_fetch_array($uResult)) { echo "<option value='{$uRow[specialization]}'>/n"; echo "{$uRow[specialization]}/n"; echo "</option>/n"; } } ?> </select></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if by specialization, please select one here </td> </tr> <tr> <td align="right"><span class="text6">per email :</span> </td> <td> </td> <td><span class="text7"> <input name="peremail" type="text" class="textfield" maxlength="100" size="40" /> </span></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if per email, please input the email address here </td> </tr> <tr> <td align="right"><span class="text6">subject :</span></td> <td> </td> <td><span class="text7"> <input name="subject" type="text" class="textfield" maxlength=100 size=40> </span></td> </tr> <tr> <td align="right" valign="top" class="text6"> </td> <td align="right" valign="top" class="text6"> </td> <td valign="top" class="text7"> </td> </tr> <tr> <td colspan="3" valign="top" class="text6"><hr></td> </tr> <tr> <td colspan="3" valign="top" class="text6">HTML BODY: copy & paste the HTML page here <span class="text7"></span> </td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><textarea id="elm1" name="message" rows="35" cols="80" style="width: 100%"></textarea></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><input type="submit" name="submit" value="send" class="textfield1" /> <input type=hidden value=http://www. name=redirect></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"> </td> </tr> </table></td> <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> </table> </form></td> <td width="6" align="right"><img src="../images/spacer.gif" width="6" height="10" /></td> </tr> </table> <?php }else{ $to = $_POST['to']; $subject = $_POST['subject']; $message = $_POST['message']; $specialization = $_POST['specialization']; if ("all" == $to) { $x = 1; $hold = 50; // quantity of emails sent before 3 sec delay $emails = mysql_query("SELECT email FROM applicant WHERE subscribe = 'yes'"); while ($sendemail = mysql_fetch_array($emails)) { $email = $sendemail["email"]; mail($email, $subject, $message, "From:JobHiRings <posmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop }elseif("notall" == $to) { $byspecialization = mysql_query("SELECT email FROM applicant WHERE specialization = '$specialization' AND subscribe = 'yes'"); while ($countmail = mysql_fetch_array($byspecialization)) { $email = $countmail["email"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>" ); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop }elseif ("peremail" == $to){ $email = $_POST["peremail"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop } } ?> Quote Link to comment Share on other sites More sharing options...
pixeltrace Posted April 9, 2007 Author Share Posted April 9, 2007 hi, its still not working. i tried sending it to my email and i wasnt able to get my test email what else do i need to do here? thanks! Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 9, 2007 Share Posted April 9, 2007 what select did you use ? Entire list Specialization Individual Email PS heres a cleaner script <?php include("db_connect.php"); if ( !isset($_POST['submit']) ) { ?> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6" align="left"><img src="../images/spacer.gif" width="6" height="10" /></td> <td width="100%"><form method="post" action="<?=$_SERVER['PHP_SELF']?>"> <table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> <td width="214" valign="top"><table width="558" border="0" cellspacing="2" cellpadding="3"> <tr> <td colspan="3" valign="top"><img src="images/spacer.gif" width="10" height="1" /></td> </tr> <tr> <td colspan="3" bgcolor="#999999" class="text2">SEND EMAIL ALERTS </td> </tr> <tr> <td colspan="3" valign="top" class="text7"> </td> </tr> <tr> <td width="119" align="right" valign="top" class="text6">send by :</td> <td> </td> <td width="412" class="text7"> <select name="to" class="textfield1"> <option selected value="all">Entire list</option> <option value="notall">Specialization</option> <option value="peremail">Individual Email</option> </select> </select></td> </tr> <tr> <td align="right"><span class="text6">by specialization : </span></td> <td> </td> <td><select name="specialization" class="textfield1"> <option value="" selected="selected">-- select specialization here --</option> <?php $uSql = "SELECT specialization FROM specialization"; $uResult = mysql_query($uSql, $connection); if(!$uResult){ echo 'no data found'; }else{ while($uRow = mysql_fetch_array($uResult)) { echo "<option value='{$uRow[specialization]}'>/n"; echo "{$uRow[specialization]}/n"; echo "</option>/n"; } } ?> </select></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if by specialization, please select one here </td> </tr> <tr> <td align="right"><span class="text6">per email :</span> </td> <td> </td> <td><span class="text7"> <input name="peremail" type="text" class="textfield" maxlength="100" size="40" /> </span></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if per email, please input the email address here </td> </tr> <tr> <td align="right"><span class="text6">subject :</span></td> <td> </td> <td><span class="text7"> <input name="subject" type="text" class="textfield" maxlength=100 size=40> </span></td> </tr> <tr> <td align="right" valign="top" class="text6"> </td> <td align="right" valign="top" class="text6"> </td> <td valign="top" class="text7"> </td> </tr> <tr> <td colspan="3" valign="top" class="text6"><hr></td> </tr> <tr> <td colspan="3" valign="top" class="text6">HTML BODY: copy & paste the HTML page here <span class="text7"></span> </td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><textarea id="elm1" name="message" rows="35" cols="80" style="width: 100%"></textarea></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><input type="submit" name="submit" value="send" class="textfield1" /> <input type=hidden value=http://www. name=redirect></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"> </td> </tr> </table></td> <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> </table> </form></td> <td width="6" align="right"><img src="../images/spacer.gif" width="6" height="10" /></td> </tr> </table> <?php }else{ $to = $_POST['to']; $subject = $_POST['subject']; $message = $_POST['message']; $specialization = $_POST['specialization']; switch($to) { case "all": $x = 1; $hold = 50; // quantity of emails sent before 3 sec delay $emails = mysql_query("SELECT email FROM applicant WHERE subscribe = 'yes'"); while ($sendemail = mysql_fetch_array($emails)) { $email = $sendemail["email"]; mail($email, $subject, $message, "From:JobHiRings <posmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop break; case "notall": $byspecialization = mysql_query("SELECT email FROM applicant WHERE specialization = '$specialization' AND subscribe = 'yes'"); while ($countmail = mysql_fetch_array($byspecialization)) { $email = $countmail["email"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>" ); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop break; case "peremail": $email = $_POST["peremail"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop break; } } ?> Quote Link to comment Share on other sites More sharing options...
pixeltrace Posted April 9, 2007 Author Share Posted April 9, 2007 individual email Quote Link to comment Share on other sites More sharing options...
pixeltrace Posted April 9, 2007 Author Share Posted April 9, 2007 hi, i tried testing it for the individual email i still cant get my test mail and another thing, when sending, its not even prompting the javascript telling me that the email alert has been submitted. this is the current code that you gave me <?php include("db_connect.php"); if ( !isset($_POST['submit']) ) { ?> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6" align="left"><img src="../images/spacer.gif" width="6" height="10" /></td> <td width="100%"><form method="post" action="<?=$_SERVER['PHP_SELF']?>"> <table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> <td width="214" valign="top"><table width="558" border="0" cellspacing="2" cellpadding="3"> <tr> <td colspan="3" valign="top"><img src="images/spacer.gif" width="10" height="1" /></td> </tr> <tr> <td colspan="3" bgcolor="#999999" class="text2">SEND EMAIL ALERTS </td> </tr> <tr> <td colspan="3" valign="top" class="text7"> </td> </tr> <tr> <td width="119" align="right" valign="top" class="text6">send by :</td> <td> </td> <td width="412" class="text7"> <select name="to" class="textfield1"> <option selected value="all">Entire list</option> <option value="notall">Specialization</option> <option value="peremail">Individual Email</option> </select> </select></td> </tr> <tr> <td align="right"><span class="text6">by specialization : </span></td> <td> </td> <td><select name="specialization" class="textfield1"> <option value="" selected="selected">-- select specialization here --</option> <?php $uSql = "SELECT specialization FROM specialization"; $uResult = mysql_query($uSql, $connection); if(!$uResult){ echo 'no data found'; }else{ while($uRow = mysql_fetch_array($uResult)) { echo "<option value='{$uRow[specialization]}'>/n"; echo "{$uRow[specialization]}/n"; echo "</option>/n"; } } ?> </select></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if by specialization, please select one here </td> </tr> <tr> <td align="right"><span class="text6">per email :</span> </td> <td> </td> <td><span class="text7"> <input name="peremail" type="text" class="textfield" maxlength="100" size="40" /> </span></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if per email, please input the email address here </td> </tr> <tr> <td align="right"><span class="text6">subject :</span></td> <td> </td> <td><span class="text7"> <input name="subject" type="text" class="textfield" maxlength=100 size=40> </span></td> </tr> <tr> <td align="right" valign="top" class="text6"> </td> <td align="right" valign="top" class="text6"> </td> <td valign="top" class="text7"> </td> </tr> <tr> <td colspan="3" valign="top" class="text6"><hr></td> </tr> <tr> <td colspan="3" valign="top" class="text6">HTML BODY: copy & paste the HTML page here <span class="text7"></span> </td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><textarea id="elm1" name="message" rows="35" cols="80" style="width: 100%"></textarea></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><input type="submit" name="submit" value="send" class="textfield1" /> <input type=hidden value=http://www. name=redirect></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"> </td> </tr> </table></td> <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> </table> </form></td> <td width="6" align="right"><img src="../images/spacer.gif" width="6" height="10" /></td> </tr> </table> <?php }else{ $to = $_POST['to']; $subject = $_POST['subject']; $message = $_POST['message']; $specialization = $_POST['specialization']; switch($to) { case "all": $x = 1; $hold = 50; // quantity of emails sent before 3 sec delay $emails = mysql_query("SELECT email FROM applicant WHERE subscribe = 'yes'"); while ($sendemail = mysql_fetch_array($emails)) { $email = $sendemail["email"]; mail($email, $subject, $message, "From:JobHiRings <posmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop break; case "notall": $byspecialization = mysql_query("SELECT email FROM applicant WHERE specialization = '$specialization' AND subscribe = 'yes'"); while ($countmail = mysql_fetch_array($byspecialization)) { $email = $countmail["email"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>" ); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop break; case "peremail": $email = $_POST["peremail"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop break; } } ?> whatelse could be wrong here? thanks! Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 9, 2007 Share Posted April 9, 2007 Heehee i notice the error in the code for that OK This works on my server i sent them to my hotmail but when ended up in my junk email folder.. try now o hope this works <?php include("db_connect.php"); if ( !isset($_POST['submit']) ) { ?> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6" align="left"><img src="../images/spacer.gif" width="6" height="10" /></td> <td width="100%"><form method="post" action="<?=$_SERVER['PHP_SELF']?>"> <table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> <td width="214" valign="top"><table width="558" border="0" cellspacing="2" cellpadding="3"> <tr> <td colspan="3" valign="top"><img src="images/spacer.gif" width="10" height="1" /></td> </tr> <tr> <td colspan="3" bgcolor="#999999" class="text2">SEND EMAIL ALERTS </td> </tr> <tr> <td colspan="3" valign="top" class="text7"> </td> </tr> <tr> <td width="119" align="right" valign="top" class="text6">send by :</td> <td> </td> <td width="412" class="text7"> <select name="to" class="textfield1"> <option selected value="all">Entire list</option> <option value="notall">Specialization</option> <option value="peremail">Individual Email</option> </select> </select></td> </tr> <tr> <td align="right"><span class="text6">by specialization : </span></td> <td> </td> <td><select name="specialization" class="textfield1"> <option value="" selected="selected">-- select specialization here --</option> <?php $uSql = "SELECT specialization FROM specialization"; $uResult = mysql_query($uSql, $connection); if(!$uResult) { echo 'no data found'; }else{ while($uRow = mysql_fetch_array($uResult)) { echo "<option value='{$uRow[specialization]}'>/n"; echo "{$uRow[specialization]}/n"; echo "</option>/n"; } } ?> </select></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if by specialization, please select one here </td> </tr> <tr> <td align="right"><span class="text6">per email :</span> </td> <td> </td> <td><span class="text7"> <input name="peremail" type="text" class="textfield" maxlength="100" size="40" /> </span></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if per email, please input the email address here </td> </tr> <tr> <td align="right"><span class="text6">subject :</span></td> <td> </td> <td><span class="text7"> <input name="subject" type="text" class="textfield" maxlength=100 size=40> </span></td> </tr> <tr> <td align="right" valign="top" class="text6"> </td> <td align="right" valign="top" class="text6"> </td> <td valign="top" class="text7"> </td> </tr> <tr> <td colspan="3" valign="top" class="text6"><hr></td> </tr> <tr> <td colspan="3" valign="top" class="text6">HTML BODY: copy & paste the HTML page here <span class="text7"></span> </td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><textarea id="elm1" name="message" rows="35" cols="80" style="width: 100%"></textarea></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><input type="submit" name="submit" value="send" class="textfield1" /> <input type=hidden value=http://www. name=redirect></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"> </td> </tr> </table></td> <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> </table> </form></td> <td width="6" align="right"><img src="../images/spacer.gif" width="6" height="10" /></td> </tr> </table> <?php }else{ $to = $_POST['to']; $subject = $_POST['subject']; $message = $_POST['message']; $specialization = $_POST['specialization']; switch($to) { case "all": $x = 1; $hold = 50; // quantity of emails sent before 3 sec delay $emails = mysql_query("SELECT email FROM applicant WHERE subscribe = 'yes'"); while ($sendemail = mysql_fetch_array($emails)) { $email = $sendemail["email"]; mail($email, $subject, $message, "From:JobHiRings <posmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop break; case "notall": $byspecialization = mysql_query("SELECT email FROM applicant WHERE specialization = '$specialization' AND subscribe = 'yes'"); while ($countmail = mysql_fetch_array($byspecialization)) { $email = $countmail["email"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>" ); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop break; case "peremail": $email = $_POST["peremail"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>"); $x++; if(okemail) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop break; } } ?> Quote Link to comment Share on other sites More sharing options...
pixeltrace Posted April 9, 2007 Author Share Posted April 9, 2007 hi, i copy exactly the codes that you gave me but it still not working. also the javascript message is not prompting also. need help. thanks! Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 9, 2007 Share Posted April 9, 2007 can you post a link to your test page (if its live) please Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 9, 2007 Share Posted April 9, 2007 i have tested it on my hotmail and yahoo both worked.. i have attached the file i used [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
pixeltrace Posted April 9, 2007 Author Share Posted April 9, 2007 hi, this is the link of my test page http://www.jobhirings.com/admean/email/blast.php thanks! Quote Link to comment Share on other sites More sharing options...
clown[NOR] Posted April 9, 2007 Share Posted April 9, 2007 i get this when I went to your testpage: Warning: main(db_connect.php) [function.main]: failed to open stream: No such file or directory in c:\hosting\webhost4life\member\diorgrace\admean\email\blast.php on line 2 Warning: main() [function.include]: Failed opening 'db_connect.php' for inclusion (include_path='.;c:\php\pear') in c:\hosting\webhost4life\member\diorgrace\admean\email\blast.php on line 2 just wanted to let you know =) Quote Link to comment Share on other sites More sharing options...
pixeltrace Posted April 9, 2007 Author Share Posted April 9, 2007 oh, because i am also testing it. by the way, during your testing is the javascript message prompting? Quote Link to comment Share on other sites More sharing options...
clown[NOR] Posted April 9, 2007 Share Posted April 9, 2007 i didn't test it cuz of the warnings =) hehe... i'll try it now, and let you know *EDIT* Yes.. Email alert something... but in the drop down it sais /nBLABLA/n... did you mean to use \n? Quote Link to comment Share on other sites More sharing options...
pixeltrace Posted April 9, 2007 Author Share Posted April 9, 2007 this is the code that MadTechie gave me <?php include("../db_connect.php"); if ( !isset($_POST['submit']) ) { ?> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6" align="left"><img src="../images/spacer.gif" width="6" height="10" /></td> <td width="100%"><form method="post" action="<?=$_SERVER['PHP_SELF']?>"> <table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> <td width="214" valign="top"><table width="558" border="0" cellspacing="2" cellpadding="3"> <tr> <td colspan="3" valign="top"><img src="images/spacer.gif" width="10" height="1" /></td> </tr> <tr> <td colspan="3" bgcolor="#999999" class="text2">SEND EMAIL ALERTS </td> </tr> <tr> <td colspan="3" valign="top" class="text7"> </td> </tr> <tr> <td width="119" align="right" valign="top" class="text6">send by :</td> <td> </td> <td width="412" class="text7"> <select name="to" class="textfield1"> <option selected value="all">Entire list</option> <option value="notall">Specialization</option> <option value="peremail">Individual Email</option> </select> </select></td> </tr> <tr> <td align="right"><span class="text6">by specialization : </span></td> <td> </td> <td><select name="specialization" class="textfield1"> <option value="" selected="selected">-- select specialization here --</option> <?php $uSql = "SELECT specialization FROM specialization"; $uResult = mysql_query($uSql, $connection); if(!$uResult) { echo 'no data found'; }else{ while($uRow = mysql_fetch_array($uResult)) { echo "<option value='{$uRow[specialization]}'>/n"; echo "{$uRow[specialization]}/n"; echo "</option>/n"; } } ?> </select></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if by specialization, please select one here </td> </tr> <tr> <td align="right"><span class="text6">per email :</span> </td> <td> </td> <td><span class="text7"> <input name="peremail" type="text" class="textfield" maxlength="100" size="40" /> </span></td> </tr> <tr> <td align="right"> </td> <td> </td> <td class="text7">*if per email, please input the email address here </td> </tr> <tr> <td align="right"><span class="text6">subject :</span></td> <td> </td> <td><span class="text7"> <input name="subject" type="text" class="textfield" maxlength=100 size=40> </span></td> </tr> <tr> <td align="right" valign="top" class="text6"> </td> <td align="right" valign="top" class="text6"> </td> <td valign="top" class="text7"> </td> </tr> <tr> <td colspan="3" valign="top" class="text6"><hr></td> </tr> <tr> <td colspan="3" valign="top" class="text6">HTML BODY: copy & paste the HTML page here <span class="text7"></span> </td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><textarea id="elm1" name="message" rows="35" cols="80" style="width: 100%"></textarea></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"><input type="submit" name="submit" value="send" class="textfield1" /> <input type=hidden value=http://www. name=redirect></td> </tr> <tr> <td colspan="3" align="center" valign="top" class="text6"> </td> </tr> </table></td> <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> </table> </form></td> <td width="6" align="right"><img src="../images/spacer.gif" width="6" height="10" /></td> </tr> </table> <?php }else{ $to = $_POST['to']; $subject = $_POST['subject']; $message = $_POST['message']; $specialization = $_POST['specialization']; switch($to) { case "all": $x = 1; $hold = 50; // quantity of emails sent before 3 sec delay $emails = mysql_query("SELECT email FROM applicant WHERE subscribe = 'yes'"); while ($sendemail = mysql_fetch_array($emails)) { $email = $sendemail["email"]; mail($email, $subject, $message, "From:JobHiRings <posmaster@jobhirings.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop break; case "notall": $byspecialization = mysql_query("SELECT email FROM applicant WHERE specialization = '$specialization' AND subscribe = 'yes'"); while ($countmail = mysql_fetch_array($byspecialization)) { $email = $countmail["email"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>" ); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop break; case "peremail": $email = $_POST["peremail"]; $okemail = mail($email, $subject, $message, "From:JobHiRings <postmaster@jobhirings.com>"); $x++; if(okemail) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; echo '<script language=javascript> alert("Email alert has been submitted!");top.location = "emailalert.php?id=1";</script>'; } // end of while loop break; } } ?> and you can check the link here http://www.jobhirings.com/admean/email/blast.php hope you could help me with this. thanks! Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 9, 2007 Share Posted April 9, 2007 if someone else could download the code and test, the javascript won't display if the message fails.. it works on mine server, i'll re-upload and send a link soon, i think theirs a problem with the mail function on your server (maybe restricted) 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.