Error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jamal
Forum Commoner
Posts: 57
Joined: Sat Oct 26, 2002 7:53 pm
Location: London

Error

Post by jamal »

can anyone help me on how to solve this problem please.
I get an error at the denoted text in the code below.

Code: Select all

<?php
if(empty($SEND)){$SEND="";}

switch($SEND){
    case "Send":
        if(!empty($MESSAGE)){
            if(empty($SUBJECT)){$SUBJECT=""}; <- here is my problem
            $HEADERS  = "MIME-Version: 1.0\r\n";
            $HEADERS .= "Content-type: text/html; charset=iso-8859-1\r\n";
            $HEADERS .= "Wrom: BRNVWWCUFPEGAUTFJMVRESKPNKMBIPBARHDM
            

            $linkID = mysql_connect([localhost [80] [<img src="images/smilies/tongue.gif" border="0" alt="">ath/to/socket], [user], [pass]);
            mysql_select_db([database], $linkID);

            $obRS = mysql_query("SELECT email FROM users", $linkID);
        
            while($row = mysql_fetch_row($obRS)){
                foreach ($row as $field){
                    mail($field, $SUBJECT, $MESSAGE, $HEADERS);
                    print "Message sent to: <b>$field</b><br>";
                }
            }

            mysql_close($linkID);
            print "<hr><b>MESSAGE DETAILS</b><hr>";
            print "<b>Subject:</b> $SUBJECT<br>";
            print "<b>Message:</b><p>$MESSAGE";
        }
        break;
    case "Preview":
        print "<TABLE BORDER=1 CELLSPACING=0 WIDTH=100% ><TR><TD VALIGN=TOP>$MESSAGE</TD>";
        print "<TD VALIGN=TOP><FORM ACTION=AutoMail.php  METHOD=POST NAME=FORM1 >";
        print "<B>SUBJECT: </B><Input TYPE=TEXT NAME=SUBJECT VALUE='$SUBJECT' ><BR>";
        print "<TEXTAREA NAME=MESSAGE STYLE='width:500;height:300' WRAP=off  >$MESSAGE</TEXTAREA><BR>";
        print "<INPUT TYPE=SUBMIT VALUE=Preview NAME=SEND > <INPUT TYPE=BUTTON ONCLICK="document.FORM1.MESSAGE.value=''" VALUE=Reset >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE=SUBMIT VALUE=Send NAME=SEND > ";
        print "</FORM></TD></TR></TABLE>";
        break;
    default:
        print "<FORM ACTION=AutoMail.php  METHOD=POST NAME=FORM1 >";
        print "<B>SUBJECT: </B><Input TYPE=TEXT NAME=SUBJECT VALUE='' ><BR>";
        print "Please type in html code below.<BR>";
        print "<TEXTAREA NAME=MESSAGE STYLE='width:500;height:300' WRAP=off  ></TEXTAREA><BR>";
        print "<INPUT TYPE=SUBMIT VALUE=Preview NAME=SEND > <INPUT TYPE=BUTTON ONCLICK="document.FORM1.MESSAGE.value=''" VALUE=Reset >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE=SUBMIT VALUE=Send NAME=SEND > ";
        print "</FORM>";
}

?>
User avatar
Sevengraff
Forum Contributor
Posts: 232
Joined: Thu Apr 25, 2002 9:34 pm
Location: California USA
Contact:

Post by Sevengraff »

if(empty($SUBJECT)){$SUBJECT=""};

shouldn't it be...

if(empty($SUBJECT)){$SUBJECT="";}
Post Reply