I want to send mail through the php and html code. I have made form in html. Here is my code
<form name="contactform" method="post" action="send_form_email.php"> 
     <table width="450px">
          <tr>   
               <td valign="top">
                    <label for="first_name">First Name *</label>
                </td>
                 <td valign="top">
                    <input  type="text" name="first_name" maxlength="50" size="30">
                </td>
            </tr>
            <tr>
                <td valign="top"">
                    <label for="last_name">Last Name *</label>
                </td>
                <td valign="top">
                    <input  type="text" name="last_name" maxlength="50" size="30">
                </td>
            </tr>       
            <tr>
                <td valign="top">
                    <label for="email">Email Address *</label>
                </td>
                <td valign="top">
                    <input  type="text" name="email" maxlength="80" size="30">
                </td>
            </tr>
            <tr>
                <td valign="top">
                    <label for="telephone">Telephone Number</label>
                </td>
                <td valign="top">
                    <input  type="text" name="telephone" maxlength="30" size="30">   
                </td>
            </tr>
            <tr>
                <td valign="top">
                    <label for="comments">Comments *</label>
                </td>    
                <td valign="top">
                    <textarea  name="comments" maxlength="1000" cols="25" rows="6"></textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align:center">
                    <input type="submit" value="Submit">Email Form
                </td>
            </tr>
        </table>
 </form>
and after that I have code in php file from that email can be send. Here is my code
<?php
    $name ="$first_name";
    $lastname ="$last_name";
    $telephone ="$telephone";
    $emailid ="$email";
    $comment ="$comments";
    //from
    $header ="from : $name <$emailid>";
    $to ="sonikaran006@gmail.com";
    $send_form_email =mail($to, $name, $lastname, $emailid, $telephone, $comment);
    if($send_form_email)
    {
    echo "We have received your information";
    }
    else
    {
    echo "Error";
    }   
?>
But when I run the form at that time it shows error and print in notepad like this
";$to ="sonikaran006@gmail.com"; $send_form_email =mail($to, $name, $lastname, $emailid, $telephone, $comment); if($send_form_email) { echo "We have received your information"; } else { echo "Error"; } ?>
So, I can't understand what's going wrong in my code. Please help me to solve this error.


