Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Design HTML email form with attachment using jquery and php

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #255413
    chauhanheena
    Participant

    Hi,
    I have a regular job application form which has two text fields Name and Contact.

    I’m using jquery and php to send the email to the employer. It’s working .

    Now I need to introduce a resume upload feature to the form
    I have added the HTML input file element to the form. But do not know how to edit the jquery and php for sending the resume as an attachment in the email

    below is the code

    HTML

    <form action="#" method="post" id="form_7350" enctype="multipart/form-data">
    <label for="cmsmasters_teachers_name">Teachers Name*</label>
    <input type="text" name="cmsmasters_teachers_name" id="cmsmasters_teachers_name" value="" size="35" />
    <label for="cmsmasters_contact_phone">Contact Phone*</label>
    <input type="text" name="cmsmasters_contact_phone" id="cmsmasters_contact_phone" value="" size="35" />
    <label for="cmsmasters_file">UPLOAD RESUME (.doc/.docx/.pdf)</label>
    <input type="file" id="cmsmasters_file" accept=".doc,.docx,.pdf">
    <a id="cmsmasters_7350_formsend" class="cmsmasters_button" href="#"><span>Submit</span></a>
    </form>
    
    

    Jquery Code


    jQuery('#form_7350 a#cmsmasters_7350_formsend').click(function () { if (jQuery('#form_7350').validationEngine('validate')) { jQuery.post('jobfile.php', { cmsmasters_teachers_name : jQuery('#cmsmasters_teachers_name').val(), cmsmasters_contact_phone : jQuery('#cmsmasters_contact_phone').val(), formname : '7350' }, function (data) { jQuery('#form_7350 .loading').animate( { opacity : 0 } , 250); jQuery('#form_7350').fadeOut('slow'); document.getElementById('form_7350').reset(); jQuery('#form_7350').parent().find('.box').hide(); jQuery('#form_7350').parent().find('.success_box').fadeIn('fast'); jQuery('html, body').animate( { scrollTop : jQuery('#form_7350').offset().top - 140 } , 'slow'); jQuery('#form_7350').parent().find('.success_box').delay(5000).fadeOut(1000, function () { jQuery('#form_7350').fadeIn('slow'); } ); } ); return false; } else { jQuery('#form_7350 .loading').animate( { opacity : 0 } , 250); return false; } } ); } );

    jobfile.php

    <?php 
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
    $teachers=$_POST['cmsmasters_teachers_name'];
    $contactnumber=$_POST['cmsmasters_contact_phone'];
    $recipients = array(
    "[email protected]"
    );
    $to=implode(',', $recipients);
    $subject="Teacher's Application - www.verandaschool.com";
    $message="Teacher's Name= ".$teachers."<br> Contact Number= ".$contactnumber;
    mail($to,$subject,$message,$headers);
    ?>
    
    

    What should I add to email the uploaded file as an attachment.
    Thanks

    #255414
    chauhanheena
    Participant

    @shikkediel : any advice on how to I go about doing this.
    Thanks

    #255444
    Shikkediel
    Participant

    I think that’s out of my league at the moment…

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design’ is closed to new topics and replies.