i have a check box where user can choose which PDF they want to download. user can choose more than one PDF..once submit ..user will get an email with the download link. i managed to email the user but unable to provide the download link based on what they choose from the checkbox.any help would be much appreciated
<?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>
and below here is the email that they will receive with the download link. from here im able to echo the device they want to download but not able to provide them the link.
<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;
?>
Aucun commentaire:
Enregistrer un commentaire