Categories

.NET (1) CSS (5) OOP (1) PHP (2) SQL (5) SQL Server (8) TSQL (1)
Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Saturday, February 12, 2011

The difference between require() and include()

Here is the explaination from PHP manual.
From PHP manual:-   
require() and include() are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, don’t hesitate to use require() if you want a missing file to halt processing of the page. include() does not behave this way, the scriptwill continue regardless. Be sure to have an appropriate include_path setting as well.

Friday, September 17, 2010

Sending HTML email through PHP

We can use mail function of PHP to send emails. For sending HTML email we've to set some headers.

Here is the syntax..


    $from="test@test.com";
    $to="test@test.com";
    $subject="your subject";



    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";    

    $headers .= "From: ".$from."\r\n";
    $headers .= "Reply-To: ".$from."\r\n";
    $headers .= "Return-Path: ".$from."\r\n";



   if (mail($to,$subject,$message,$headers) )
   {
   echo 'Successfully sent'; 

    } else {

       echo "Email address is not valid";

    }