我有一个复选框,用户可以选择要下载哪个PDF。用户可以选择多个PDF ..提交..用户将得到一个电子邮件与下载链接。我设法向用户发送电子邮件,但无法提供基于他们从checkbox.any帮助选择什么样的下载链接,将不胜感激如果选中复选框,如何使用echo下载链接
<?php
session_start();
require_once('/config/database.php') ;
error_reporting(0);
//if(isset($_POST['submit'])){
if(isset($_POST) && ($_POST['submit'] == 1)){
$error = '';
$name = $_POST['name'];
$email = $_POST['email'];
$Country = $_POST['Country'];
$checkBox = implode('<br>', $_POST['download']);
$registered_at = date('Y-m-d H:i:s');
//foreach($_POST['download'] as $value) {
//$check_msg .= "Checked: $value\n";
}
if ($_POST['secCode'] != $_SESSION['securityCode']) {
// unset($_SESSION['securityCode']);
$error .= "<script>alert('Sorry the security code is invalid. Please try it again')</script>";
}
if ($error == ''){
foreach($_POST AS $key => $value) { $_POST[$key] = mysql_real_escape_string($value); }
$sql = "INSERT INTO users (name, email, country,download, registered_at)
VALUES ('$name','$email', '$Country', '" . $checkBox . "', '$registered_at')";
if (mysql_query($sql)){
//email function start
//html checkbox
<div class="control-group">
<div class="controls">
<p><h5>Select device to download ( <input type='checkbox' name='checkall' onclick='checkedAll(subscribe);'><label>  Select all</label>) </h5></p>
<!--DIAGNOSTIC DEVICES-->
<input id="1" class="placeholder span4_1" type="checkbox" name="download[]" value="1"><label>1</label><br>
<input id="2" class="placeholder span4_1" type="checkbox" name="download[]" value="2"><label>2</label><br>
<input id="3" class="placeholder span4_1" type="checkbox" name="download[]" value="3"><label>3</label> <br>
<input id="4" class="placeholder span4_1" type="checkbox" name="download[]" value="4"><label>4</label><br>
<input id="5" class="placeholder span4_1" type="checkbox" name="download[]" value="5"><label>5</label><br>
<input id="6" class="placeholder span4_1" type="checkbox" name="download[]" value="6"><label>6</label> <br>
<!--THERAPEUTIC DEVICES-->
<input id="7" type="checkbox" name="download[]" value="7"><label>7</label><br>
<input id="8" type="checkbox" name="download[]" value="8"><label>8</label><br>
<span class="help-inline"></span>
</div>
</div>
及以下这里是他们将收到下载链接的电子邮件。从这里无法回显他们想下载的设备,但无法为他们提供链接。
<html>
<head></head>
<body>
<b><font size="4"> Download Link</font></b><BR><BR>
<p>Dear <?php echo $name ?>,</p>
<p>Thank you for signing up at <a href="http://localhost/test/" target="_blank"> test.com</a>.<br>
<p>Following is the link to download the device pdf that you have selected.</p><br>
<?php
echo $checkBox;
?>
不知道你有什么问题 –
即时无法回显基于复选框的下载链接他们打勾.. – ksonia90