php - 在 php 中重复发送电子邮件以获取注册表单

标签 php mysql database

如何在此代码中添加重复功能以进行电子邮件重复?

我有检查电子邮件的功能是否已存在于数据库中,但我想再次使用电子邮件功能来重新输入电子邮件。我怎样才能在我的代码中做到这一点。谁能帮我吗?

<?php 
    include("includes/connect.php"); 

    if(isset($_POST['submit'])) { 
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];

        if($...=='') {
           echo"<script>alert('please enter the ...')</script>";
           exit();
        }
        if($...=='') {
           echo"<script>alert('please enter the ...')</script>";
           exit();
        }
        if($...=='') {
           echo"<script>alert('please enter the ...')</script>";
           exit();
        }
        if($...=='') {
           echo"<script>alert('please enter the ...')</script>";
           exit();
        }

        $check_... = "SELECT * FROM ... where ...='$...'";
        $run = mysql_query($check_...);
        if(mysql_num_rows($run)>0) {
            echo "<script>alert('... $... is alredy exist in database , please try other ...')</script>";
            exit();
        }

        $query ="INSERT INTO ... (...,...,..., ...,...,...,...,...,...) VALUES ('$...','$...','$...', '$...','$...','$...','$...','$...,'$...')";

        if(mysql_query($query)) {
            echo "<script>alert('Registiration was succesfully!')</script>";
        }
    }
?> 

最佳答案

我希望这不是生产代码,因为代码具有潜在的 SQL 注入(inject)(请检查此 What is SQL injection? )。但无论如何关于你的问题。您需要添加简单的检查来实现您想要的:

    ...

    if($business_name == ''){
       echo"<script>alert('please enter the usernme')</script>";
       exit();
       }
    if($email == ''){
       echo"<script>alert('please enter the email')</script>";
       exit();
       }

    //check for matching
    if($email != $emailagain){
       echo"<script>alert('entered email addresses don't match')</script>";
       exit();
       }
    $check_email = "SELECT * FROM ... where ...='$...'";
    ...

关于php - 在 php 中重复发送电子邮件以获取注册表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20363840/

相关文章:

php - 在 Laravel 5 中更新时验证唯一的 Slug

php - 递归和引用传递

php - 格式化mysql查询日志文件输出

mysql - 应该在 mysql 中的哪里定义 create TRIGGER

python MySQL Fetchone/Fetchall 更新

python - 如何从具有匹配 block 值的 block 中复制 pandas 中的第一行和最后一行?

mysql - 一对一单列表的DB设计

php - 传递变量作为上传目录

php - 使用 MySQL 5.6 版从源代​​码编译 PHP

php - 基于PHP转发域名邮箱