Topic: Can someone help re-write code for $ ? - problem with if/else statements (Read 1088 times)
My Name is Enigo Montoya
Posts: 33
188 credits Members referred : 0
« on: Mar 22, 2008, 01:48:22 am »
Everything works as far as both mail formats being sent, but I am trying to add validation to it so it checks that the fields aren't blank before the mail is sent. A lot of this is existing code that I am working with to modify, so it does reference possibly an older version of php(things such as $HTTP_POST_VARS) The validation code at the top, is used in several other pages, so I am just using it here. The validation shows correctly, but my problem is that after the errors are echo'ed the rest of the code is executed which sends blank mail. The code between the #####'s is all the code that prepares the mail and sends it.
I don't mind to donate to anyone that might be able to help.
Code:
<p id="sectionTitle"><?php echo PAGETITLE_SEND_NEWSLETTER ?></p> <p><a href="index.php?page=../massemail/mass_email_admin_menu" class="linkBg">« Back</a></p> <?php require_once "../include/Validator.php"; if ($HTTP_POST_VARS){ $validator = new Validator(); $validator->validateGeneral($HTTP_POST_VARS['subject'], NEWSLETTER_VAL_SUBJECT); $validator->validateGeneral($HTTP_POST_VARS['text_message'], NEWSLETTER_VAL_TEXT); $validator->validateGeneral($HTTP_POST_VARS['fckeditor'], NEWSLETTER_VAL_EDITOR); if ( $validator->foundErrors() ){ echo '<b style="color:#C92E2A; font-size:12px;"> '. ERROR_PLEASE_INSERT .' </b> <br /><i>'.$validator->listErrors('<br>').'</i><br><br /><br /><br /> <a href="index.php?page=../massemail/new2" class="linkBg">« Back - show form again</a>'; }else{ //echo "<p><a href=\"index.php?page=../massemail/new2\" class=\"linkBg\">« Back - show form again</a></p>"; } } ?> <?php require_once 'system_data.php'; $query = "select fname,email from newsletter where status='1'"; $result = mysql_query($query) or die(mysql_error());
if (0 == mysql_num_rows($result)) { echo "<p>".SEND_NEWSLETTER_EMPTY_SUBSCRIBERS_LIST."</p>"; } else { if (isset($_POST['submit'])) {
while (list($full_name,$email) = mysql_fetch_row($result)) {
################################################## // load email class definition.
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #1 on: Mar 22, 2008, 07:43:46 am »
look maybe your mailscript has genertated some error, use products like tinymce (fuckeditor sucks) and phpmailer to be safe that your scripts are fine.
enable error_reporting too (this problem is not some if/else statement)
My Name is Enigo Montoya
Posts: 33
188 credits Members referred : 0
« Reply #2 on: Mar 23, 2008, 03:28:47 am »
This is very true Olaf...(fuckeditor sucks) Very buggy at times I have noticed. I'll have to ask my client again why they like it so much...maybe they think it looks nice...LOL I'll see what I can come up with, thanks!
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #3 on: Mar 23, 2008, 08:43:11 am »
I think if you change it too tinymce and you tell the customer it's a new version he will never notice
try a different mail script first to find the bug...
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7668