电子邮件订阅频率php mysql

时间:2014-12-08 07:49:17

标签: php mysql forms subscription

好吧,伙计们,我今天发布了很多内容......我还有很长的路要走。基本上我正在开发一个需要一个功能齐全的DB / PHP功能的术语项目。我选择了一个订阅功能,允许"客户端"通过表格订阅接收新产品的更新。

到目前为止,我已将表单设置为向DB提交信息的位置......但我没有将其设置为根据用户选择的频率更新向客户端发送电子邮件。我知道我需要用产品制作一张桌子,这些都将完成。我将要做的最大问题是如何使这项工作成功?如何使此功能正常工作,以便在提交新产品时,它将向客户发送基于他们选择的选择到达的新产品的电子邮件...每日更新/每周更新/每月更新。我会发布到目前为止的内容,这对我来说是一个新的视野......我会得到任何帮助。

这是我的HTML:

<form action="form.php" method="POST">

<div class="row">
    <div class="large-4 columns">

        <span id="spryfirstname">
            <input name="firstname" type="text" class="text" placeholder="First Name"/>
            <span class="textfieldRequiredMsg">A value is required.</span></span>
    </div>

    <div class="large-4 columns">

        <span id="sprylastname">
            <input name="lastname" type="text" class="text" placeholder="Last Name"/>
            <span class="textfieldRequiredMsg">A value is required.</span></span>
    </div>

    <div class="large-4 columns">
        <div class="row collapse">

            <div class="small-9 columns">
                <span id="spryemail">
                    <input name="email" type="text" placeholder="email@example.com"/>
                    <span class="textfieldRequiredMsg">A value is required.</span</span>
            </div>
        </div>
    </div>
</div>
<div class="row">
    <div class="large-12 columns">
        <label>Check all Products that you're interested in</label>
        <div>
            <input name="products[]" type="checkbox" value="all">ALL PRODUCTS/SERVICES</label>
            <input name="products[]" type="checkbox" vallue="trade"><label>Trade-in</label>
            <input name="products[]" type="checkbox" value="layaway"><label>Layaway products</label>
            <input name="products[]" type="checkbox" value="theatre"><label>Home Theatre Systems</label>
            <input name="products[]" type="checkbox" value="TV"><label>HD TVs</label>
            <input name="products[]" type="checkbox" value="Games"><label>Video Game Consoles</label>
            <br>
            <input name="products[]" type="checkbox" value="laptops"><label>Laptops</label>
            <input name="products[]" type="checkbox" value="monitors"><label>Monitors</label>
            <input name="products[]" type="checkbox" value="phones"><label>Phones</label>
            <input name="products[]" type="checkbox" value="cameras"><label>Cameras</label>
            <input name="products[]" type="checkbox" value="acoustic"><label>Acoustic Guitars</label>
            <input name="products[]" type="checkbox" value="electric"><label>Electric Guitars</label>
            <input name="products[]" type="checkbox" value="drums"><label>Drums</label>
            <input name="products[]" type="checkbox" value="wind"><label>Wind Instruments</label>
            <br>
            <input name="products[]" type="checkbox" value="pianos"><label>Pianos</label>
            <input name="products[]" type="checkbox" value="violins"><label>Violins</label>
            <input name="products[]" type="checkbox" value="diamonds"><label>Diamonds</label>
            <input name="products[]" type="checkbox" value="neck"><label>Necklaces</label>
            <input name="products[]" type="checkbox" value="rings"><label>Rings</label>
            <input name="products[]" type="checkbox" value="ear"><label>Ear Rings</label>
            <input name="products[]" type="checkbox" value="gold"><label>Gold Jewelry</label>
            <input name="products[]" type="checkbox" value="silver"><label>Silver Jewelry</label>
            <hr>
        </div>
    </div>
    <div class="row">
        <div class="large-12 columns">
            <label>How often would you like to have product updates?
                <select>
                    <option value="daily" name"Updates">Daily</option>
                    <option value="weekly" name"Updates">Weekly</option>
                    <option value="monthly" name"Updates">Monthly</option>
                </select> </label>
        </div>
    </div>
    <div class="row">
        <div class="large-12 columns">
            <label>Tell us a little about yourself<textarea placeholder="Type here"></textarea> </label>
        </div>
    </div>
    <div class="row">

        <input class="button small large-3" type="submit" name"submit" />
    </div>

这是我与DB和PHP的连接:

if(isset($_POST['submit'])){
$con = mysqli_connect("localhost","dxh6110","tcqfoz7","dxh6110") 
   or die("Error " . mysqli_error($con)); 


$first = stripslashes($_POST['firstname']);
$last = stripslashes($_POST['lastname']);
$email = stripslashes($_POST['email']);
$checkbox = stripslashes($_POST['products']);
$update = stripslashes($_POST['updates']);

$first = mysqli_real_escape_string($con,$_POST['firstname']);
$last = mysqli_real_escape_string($con,$_POST['lastname']);
$email = mysqli_real_escape_string($con,$_POST['email']);
$checkbox = mysqli_real_escape_string($con,$_POST['products']);
$checkbox = mysqli_real_escape_string($con,$_POST['updates']);

$checkbox = implode(',', $_POST['products']);






$sql = "INSERT INTO Register (First,Last,Email,Product,Updates)  
    VALUES('".$first."','".$last."','".$email."','".$checkbox."','".$update."')";
  }

mysqli_query($con,$sql);
mysqli_close($con);

?>

这可能吗?

0 个答案:

没有答案