PHP Question

I created a form and also done with email also.But Now issue is when form is submitted then details to be sent to email and also file to be downloaded automatically when mail is sent.File is located in folder only. So the file in that folder to be downloaded when click on submit button.

Code?

[php]


<input type=“mobile” for="mobile"placeholder=“Mobile* (include ISD code)” required>





For details/demo


[/php]

[php]


<input type=“mobile” for="mobile"placeholder=“Mobile* (include ISD code)” required>





For details/demo



Here is form.php code

<?php if(isset($_POST['send'])) { $to = 'xxxxxx'; $from_email = $_POST['email']; //sender email $subject = 'Enquiry Form'; $headers = "From: " . $from_email . "\r\n"; $headers .= "Reply-To: ". strip_tags($_POST['email']) . "\r\n" ."X-Mailer: PHP/" . phpversion(); $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; // PREPARE THE BODY OF THE MESSAGE $message = ''; $message .= ''; $message .= ""; $message .= ""; $message .= ""; $message .= ""; $message .= ""; $message .= ""; if(mail($to,$subject,"",$header)){ echo "success"; }else{ echo "fail"; } $message .= "
Name : " . strip_tags($_POST['name']) . "
Name : " . strip_tags($_POST['name2']) . "
Mobile No: " . strip_tags($_POST['mobile']) . "
Email: " . strip_tags($_POST['email']) . "
Location: " . strip_tags($_POST['location']) . "
Your Comments: " . strip_tags($_POST['comment']) . "
"; $message .= ""; //echo $message; //die(); if (mail($to, $subject, $message, $headers)){ $success = " Thanks for Your Feedback. "; }else{ $success = "Message Sending Failed, try again"; } if (mail($to, $subject, $message, $headers)){ $success = " Thanks for Your Feedback. "; }else{ $success = "Message Sending Failed, try again"; } ?>
        <?php

}
?>

[/php]

I am going to use JQuery for this exercise.

[php]<!doctype html>


For details/demo Here

[/php]

Now, what you need to do, aside from change your PHP to not need the actual button clicked, is to trap the click event on the link, and redirect it to click something else, the button. Then, everything works in series.

Oh Thank q for Your Support…

Sponsor our Newsletter | Privacy Policy | Terms of Service