PHP_USER1
PHP_USER1

Reputation: 628

after click send a mail , shows me the error

include "config.php";
$update=false; 
            if(isset($_POST['sub'])){
                if(!empty($_POST['del'])) {
                    $add=$_POST['del'];
                }
                if(!empty($_POST['mail'])) {
                    $mail=$_POST['mail'];
                }

                    for($j=0;$j<count($mail)){
                        $email = $mail[$j] ;
                        $subject .= "Enquiries from User:";
                        $message .= "message9\n";
                        $message .= "message8 \n";
                        $message .= "message7\n";
                        $message .= "message6 \n";
                        $message .= "message5 \n";
                        $message .= "Address :59 lig flats \n";
                        $message .= "Gandhi Marg, New Delhi 110001\n";
                        $message .= "message2 \n ";
                        $message .= "message3 \n";
                        $message .= "message4\n";
                        $from .= "[email protected]";
                        $headers = "From:" . $from;
                        mail($email, $subject,$message, $headers);
                        $j++;
                    }
                    for($i=0;$i<count($add);$i++) {
                        $h=mysql_query("UPDATE bbg_table SET approval='yes' where id='".$add[$i]."' ");
                        $update=true;
                    }

            }
if($update){
    header("location:db.php");
}           
?>

$_POST['del'] is a array which contains the the id of a user $_POST['mail'] is a array whcih contains the email of a user , now my problem is when the user comes in this page It shows me the error

**Notice: Undefined variable: subject in /home/britaini/public_html/admin/del.php on line 17
Notice: Undefined variable: message in /home/britaini/public_html/admin/del.php on line 18
Notice: Undefined variable: from in /home/britaini/public_html/admin/del.php on line 29
Warning: Cannot modify header information - headers already sent by (output started at /home/britaini/public_html/admin/del.php:17) in /home/britaini/public_html/admin/del.php on line 40**

I am not able to understand my problem please can anyone help me in this

Upvotes: 0

Views: 47

Answers (1)

Satish Sharma
Satish Sharma

Reputation: 9635

correct your code

$subject = "Enquiries from User:"; // problem-1 is here
$message = "message9\n"; // problem-2 is here
$message .= "message8 \n";
$message .= "message7\n";
$message .= "message6 \n";
$message .= "message5 \n";
$message .= "Address :59 lig flats \n";
$message .= "Gandhi Marg, New Delhi 110001\n";
$message .= "message2 \n ";
$message .= "message3 \n";
$message .= "message4\n";
$from = "[email protected]"; // // problem-3 is here  

when you use first time the variable use only = not .=

Upvotes: 1

Related Questions