php - Corresponding file start downloading automatically after form submission -


can recommend best solution this?

i add reveal popup on wordpress site. in website there download page contain 6 pdf file. integrate popup it, when click on download button of pdf file popup appears automatically. popup contain subscription form name, email address, address field.

popup, form works properly. need- corresponding file(depends on link clicked) start downloading automatically after form submission.

html code

<div style="width:100%;">    <div style="width:30%; float:left;">         <h6>top tips make vs. buy decisions</h6>         <p>make vs. buy (mvb) integral part of purchasing function. have give information , make decisions on best strategic fit of our manufacturing operations whether in-house or in supply chain. here pointers right.</p>         <a href="pdffile1.pdf" class="big-link" data-reveal-id="mymodal"><img src="http://inxpresssheffield.co.uk/wp-content/uploads/2013/07/document.png" alt="" /></a>     </div>     <div style="width:30%; float:left;">         <h6>top tips make vs. buy decisions</h6>         <p>make vs. buy (mvb) integral part of purchasing function. have give information , make decisions on best strategic fit of our manufacturing operations whether in-house or in supply chain. here pointers right.</p>         <a href="pdffile2.pdf" class="big-link" data-reveal-id="mymodal"><img src="http://inxpresssheffield.co.uk/wp-content/uploads/2013/07/document.png" alt="" /></a>     </div>     <div style="width:30%; float:right;">         <h6>top tips make vs. buy decisions</h6>         <p>make vs. buy (mvb) integral part of purchasing function. have give information , make decisions on best strategic fit of our manufacturing operations whether in-house or in supply chain. here pointers right.</p>         <a href="pdffile3.pdf" class="big-link" data-reveal-id="mymodal"><img src="http://inxpresssheffield.co.uk/wp-content/uploads/2013/07/document.png" alt="" /></a>     </div> </div> <div id="mymodal" class="reveal-modal">     <h1>thanks clicking</h1><br />     <p class="popup_text">in order receive access document please complete details below.</p>     <p class="popup_text">from time time may send information think relevant interests, can unsubscribe @ time emailing unsubscribe <a href="mailto:enquiriesuk122@inxpress.com" style="text-decoration:none; color:#000; font-weight:bold;">enquiriesuk122@inxpress.com</a></p>     <form method="post" action="http://inxpresssheffield.co.uk/popup/submit.php" style="display:block !important;">         <span class="popup_label">name:</span><span style="margin-left:76px;"><input type="text" name="name" class="popup_input" /></span><br />         <span class="popup_label">company name:</span><span style="margin-left:10px;"><input type="text" name="company" class="popup_input" /></span><br />         <span class="popup_label">email address:</span><span style="margin-left:20px;"><input type="text" name="email" class="popup_input" /></span><br /><br />         <input type="submit" name="submit" value="submit" class="submit" />     </form>     <a class="close-reveal-modal">&#215;</a> </div> 

php code

<?php    $to = "gamarsh@yahoo.co.uk";    $subject = "downloadable documents";    $message = "hey, sent contact message via download section of website.details below-name: $_post[name]company name: $_post[company] email address: $_post[email] ip: ".$_server['remote_addr']."";    $from = "info@inxpresssheffield.co.uk";    $headers = "from:" . $from;    mail($to,$subject,$message,$headers);    header("location:http://inxpresssheffield.co.uk/downloads/"); ?> 

maybe can add <input type="hidden" name="thefile"/> , modify value of input javascript when user click link?

you can value $_post["thefile"] in php, can add redirect (header()).

note may use relative links instead of absolute in case hostname change later.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -