-1

任何人都可以为此推荐最佳解决方案吗?

我在我的 wordpress 网站上添加了 Reveal 弹出窗口。在我的网站上有一个包含 6 个 PDF 文件的下载页面。我将弹出窗口与它集成,当任何人单击任何 PDF 文件弹出窗口的下载按钮时,都会自动出现。弹出窗口包含一个带有名称、电子邮件地址、地址字段的订阅表单。

弹出窗口,表单一切正常。我只需要-相应的文件(取决于单击的链接)在表单提交后自动开始下载。

HTML 代码

<div style="width:100%;">
   <div style="width:30%; float:left;">
        <h6>Top tips for Make Vs. Buy decisions</h6>
        <p>Make Vs. Buy (MvB) is an integral part of any purchasing function. We have to give information and help make decisions over the best strategic fit of our manufacturing operations whether in-house or in the supply chain. Here are some pointers to help you get it 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 for Make Vs. Buy decisions</h6>
        <p>Make Vs. Buy (MvB) is an integral part of any purchasing function. We have to give information and help make decisions over the best strategic fit of our manufacturing operations whether in-house or in the supply chain. Here are some pointers to help you get it 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 for Make Vs. Buy decisions</h6>
        <p>Make Vs. Buy (MvB) is an integral part of any purchasing function. We have to give information and help make decisions over the best strategic fit of our manufacturing operations whether in-house or in the supply chain. Here are some pointers to help you get it 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 for clicking</h1><br />
    <p class="popup_text">In order to receive access to your document please complete the details below.</p>
    <p class="popup_text">From time to time we may send you information that we think will be relevant to your interests, however you can unsubscribe at any time by emailing UNSUBSCRIBE to <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 代码

<?php
   $to = "gamarsh@yahoo.co.uk";
   $subject = "Downloadable Documents";
   $message = "Hey, Someone Sent you a Contact Message via Download Section of your 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/");
?>
4

1 回答 1

0

也许您可以添加类似 an 的<input type="hidden" name="thefile"/>内容,然后在用户单击链接时使用 JavaScript 修改此输入的值?

您可以使用 PHP 中的 取回该值$_POST["thefile"],以便将其添加到重定向 (header())。

请注意,如果您的主机名稍后更改,您可以使用相对链接而不是绝对链接。

于 2013-07-22T09:11:05.337 回答