Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

mail function doesn't work

the mail() function

Moderators: macek, egami, gesf

mail function doesn't work

Postby abdbad2015 » Thu May 01, 2014 10:52 pm

Hi
Hi , I'm newbie in php.
my code is
Code: Select all
<?php
        // error reporting method will be discussed
        error_reporting(E_ALL&~E_NOTICE);
echo"welcome";
        if($_post['submit']){
            $title =$_post['title'];
            $name =$_post['name'];
            $mail=$_post['email'];
            $message =$_post['message'];
           
            $body = "you have the following from".$name."<br/>";
            $body .= "<p><b>".$title."</b></p>";
            $body .= "<p>".$message."</p>";
           
           
             //build emial
             $to = "abdallahbadarneh@yahoo.com" ;
             $header="From : ($name)<($email)";
             $subject="you have 1 feedback";
             $messge=$body;
             if(mail($to,$subject,$messge,$header)){
                 echo "thank you for yourfeedback";
             }else{
                 echo "unfortunatly , we have problem"; }
                 }
                 ?>

the problem is that it doesn't print the statement of [if] or the statement of [else] , why?
abdbad2015
New php-forum User
New php-forum User
 
Posts: 3
Joined: Sun Apr 27, 2014 7:49 am

Re: mail function doesn't work

Postby seandisanti » Thu May 01, 2014 11:32 pm

you can use if ($_POST) to check if the post superglobal is instantiated, but to check an individual element, you should use isset($_POST['submit'])
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP coding => Mail

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.