title: how to attach and send file in email using form php
body: <p>In the below code i have 3 files ( job.php, form.php, sendmail.php ) </p>
  
  <p>In job.php i have job mentioned if the jobseeker click apply button it then go to form.php where the jobseeker fill their detail after they submit then the mail go to employer.</p>
  
  <p><strong>In form.php i have file attachment code where the jobseeker attach their resume 
  i don't know how to attach file in email(sendmail.php)</strong></p>
  
  <p><em><strong>help me how to attach and send file in email using form</em></strong></p>
  
  <h1>job.php</h1>
  
  <pre><code>    &lt;form method="post" action="form.php" id="dataentry"&gt;
        &lt;div class="jobopen"&gt;
              &lt;h2&gt;Urgent Opening for Data Entry&lt;/h2&gt;
              &lt;p&gt;&amp;nbsp;&lt;/p&gt;
              &lt;p&gt; &lt;strong&gt;Job Description:&lt;/strong&gt;&lt;/p&gt;
              &lt;p&gt;Dear candidate,Required for the job: 00-01 year 
            Data operator 6500 2nd and night shift required speed 25 wpm Experience. Annual Salary of the job: 185000 -240000
            Location: Maharashtra &lt;/p&gt;
              &lt;p&gt;&lt;strong&gt;PROFILE:&lt;/strong&gt; Data Entry Executive 
            Qualification:Hsc Pass
            If you are interested, walk in at the following venue to kick start
            your career &lt;/p&gt;
              &lt;p&gt;&amp;nbsp; &lt;/p&gt;
              &lt;input type="submit" value="Apply"/&gt;
            &lt;/div&gt;
      &lt;/form&gt;
          &lt;br /&gt;
          &lt;br /&gt;
          &lt;form method="post" action="form.php"&gt;
        &lt;div class="jobopen"&gt;
              &lt;h2&gt;Urgent Opening for Telecaller&lt;/h2&gt;
              &lt;p&gt;&amp;nbsp;&lt;/p&gt;
              &lt;p&gt; &lt;strong&gt;Job Description:&lt;/strong&gt;&lt;/p&gt;
              &lt;p&gt;Dear candidate,Required for the job: 00-01 year 
            Telecaller 6500 2nd and night shift required speed 25 wpm Experience. Annual Salary of the job: 185000 -240000
            Location: Maharashtra &lt;/p&gt;
              &lt;p&gt;&lt;strong&gt;PROFILE: &lt;/strong&gt;Telecaller Qualification:Hsc Pass
            If you are interested, walk in at the following venue to kick start
            your career &lt;/p&gt;
              &lt;p&gt;&amp;nbsp; &lt;/p&gt;
              &lt;input type="submit" value="Apply"/&gt;
            &lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  
  <h1>form.php</h1>
  
  <pre><code>&lt;form action="sendmail.php" method="post" enctype="multipart/form-data" &gt;
        &lt;label&gt;Name:&lt;/label&gt;
        &lt;input type="text" name="name"  /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        &lt;label&gt;Email-ID:&lt;/label&gt;
        &lt;input type="text" name="email"/&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        &lt;label&gt;Phone No:&lt;/label&gt;
        &lt;input type="text" name="phone" /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        &lt;label&gt;Upload Resume&lt;/label&gt;
        &lt;input type="file" name="file" id="file"/&gt;&lt;br /&gt;&lt;br /&gt;   
        &lt;input style="display:block; margin-left:35em;"type="submit" value="Submit"/&gt;
      &lt;/form&gt;
  </code></pre>
  
  <h1>sendmail.php</h1>
  
  <pre><code>&lt;?php
  $to = "admin@companywebsite.co.in";
  
          // Change this to your site admin email
  
          $from = "$_POST[email]";
  
          $subject = "online Job Register form FROM $_POST[name] ";
  
          //Begin HTML Email Message where you need to change the activation URL inside
  
          $message = '&lt;html&gt;
  
          &lt;head&gt;
  
          &lt;style&gt;
  
  label {
  
        width: 10em;
  
        float: left;
  
        text-align: right;
  
        margin-right: 2em;
  
        display: block;
  
        }
  
          &lt;/style&gt;
  
          &lt;/head&gt;
  
          &lt;body bgcolor="#ffffff"&gt;
  
  
          &lt;label&gt;Name:&lt;/label&gt;'.$_POST['name'].'&lt;br /&gt;&lt;br /&gt;
  
          &lt;label&gt;E-mail Address:&lt;/label&gt;'.$_POST['email'].'&lt;br /&gt;&lt;br /&gt;
  
          &lt;label&gt;Mobile No:&lt;/label&gt;'.$_POST['phone'].'&lt;br/&gt;&lt;br /&gt;
  
  &lt;br /&gt;
  
  
  
    &lt;br /&gt;
  
          Thanks! &lt;br /&gt;
  
          '.$_POST['name'].'
  
          &lt;/body&gt;
  
          &lt;/html&gt;';
  
          // end of message
  
          $headers = "From: $from\r\n";
  
          $headers .= "Content-type: text/html\r\n";
  
          $to = "$to";
  
          // Finally send the activation email to the member
  
          mail($to, $subject, $message, $headers);
  
          // Then print a message to the browser for the joiner 
  
  
  
  print "&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Thank you for contacting us. We will be in touch with you very soon&lt;/h4&gt;&lt;br /&gt;";
  
  
  ?&gt;
  </code></pre>