<?php

            if(!empty($_POST[`submit`])){
                if(empty($_POST[`user_name`])||
                if(empty($_POST[`phone_number`])||
                if(empty($_POST[`email`])||
                if(empty($_POST[`password`])||  
                if(empty($_POST[`confirm_password`]))
                {
                    exit("please fill in all the fields.
                        <a href = './register.php'>return</a>");

                }
                if(empty($_POST[`password`]!==$_POST[`confirm_password`])
                {   
                    exit("passwords must match.
                        <a href = './register.php'>return</a>");
                }

                $pattern="/^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/";
                if(!pregmatch($pattern,$POST[`email`]))
                {
                   exit("please enter a valid email address.
                       <a href = './register.php'>return</a>");
                }

                            $pwd = $_POST['password '];
                        if( strlen($password ) < 8 ) {
                        $error .= "Password too short!
                        ";
                        }
                        if( strlen($password ) > 20 ) {
                        $error .= "Password too long!
                        ";
                        }
                        if( strlen($password ) < 8 ) {
                        $error .= "Password too short!
                        ";
                        }
                        if( !preg_match("#[0-9]+#", $password ) ) {
                        $error .= "Password must include at least one number!
                        ";
                        }
                        if( !preg_match("#[a-z]+#", $password ) ) {
                        $error .= "Password must include at least one letter!
                        ";
                        if( !preg_match("#[A-Z]+#", $password ) ) {
                        $error .= "Password must include at least one CAPS!
                        ";
                        }
                        if( !preg_match("#\W+#", $password ) ) {
                        $error .= "Password must include at least one symbol!
                        ";
                        }
                        if($error){
                        echo "Password validation failure(your choise is weak): $error";
                        } else {
                        echo "Your password is strong.";
                        }

                $user_name     =addslashes($_POST[`user_name`]);
                $phone_number  =addslashes($_POST[`phone_number`]);
                $email         =addslashes($_POST[`email`]);
                $password      =addslashes($_POST[`password`]); 

            require_once("./connect.php");

            $sql="SELECT * FROM `customer_information_table` WHERE `email`='{email}'";  

            $result = $db->query($sql);
                  if($db->error)
                    {
                        exit("SQL error.
                             <a href = './register.php'>return</a>");
                    }

                  if($result->num_rows!==0)
                  {
                    exit("email address already exists.
                         <a href = './register.php'>return</a>");
                  }

            //destroy new object and inserting data into db
             $result->() ; 
             $password=md5($password);
             $sql="INSERT INTO `customer_information_table`
                   SET
                        `user_name`    ='($user_name)',  
                        `phone_number` ='($phone_number)',
                        `email`        ='($email)',
                        `password`     ='($password)'";

            $result = $db->query($sql);
               if($result === true)
               {
                echo"registration successful.<br/>";
               else
                echo"registration failed.<br/>";
               }

            $db->close();

            }

            ?> <!DOCTYPE html> <html> <title>Account information</title> <meta http-equiv='content-type' content = 'text/html';charset='utf-8'/> <script src="https://kit.fontawesome.com/1cc03fe4de.js" crossorigin="anonymous"></script><link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css"/> <style>
                    *{margin:0px;padding:0px;}

                    .header{
                    text-align:center;
                    }

                    .fa-trash-alt
                    {
                    color:green;
                    font-size:80px;
                    }

                    .footer {text-decoration:none;color:blue;text-align:center;}
                    .separator{
                    display:in-line block;width:30px;
                    }

                    .login
                    {
                    width:300px; height:400px;
                    background:white;
                    border:2px grey solid;
                    margin:0 auto;
                    -webkit-border-radius:5px;
                    -mo-border-radius:5px;
                    -o-border-radius:5px;
                    -trident-border-radius:5px;
                    padding:25px;
                    }
                    .fourth-level a{float:right;}

                    .placeholder{width:1px;height:20px;}

                    input{height:30px;width:300px;}

                    </style> </head> <body> <div class='header'> <i class="fas fa-trash-alt fa-7x"></i> </div> <div class='login'> <div class='placeholder'></div> <h1 style="text-align: center;">Sign up</h1> <div class='placeholder'></div> <form action="" method="POST"> <label for="username">username </label> <input type="text" name="username" placeholder="enter your username ..."> <label for="phone number">phone number </label> <input type="phone number" name="phone number" placeholder="enter your phone number ..."> <label for="Email">Email </label> <input type="text" name="email" placeholder="enter your email ..."> <label for="password">password</label> <input type="password" name="password" placeholder="enter your password ..."> <label for="confirm password">confirm password </label> <input type="email" name="confirm_password" placeholder="confirm your password..."> <button name="submit" type="submit" value="submit">submit</button> </form> <span>if registered. <a href="signin.html">login </a> </span> </div> <!-- <div class='footer'> <div class='placeholder'></div> <div class='three-item-list'> <a href ='#'>conditions of use</a> <span class='separator'></span> <a href ='#'>privacy notice</a> <span class='separator'></span> <a href ='#'>help</a> </div> </div -->> </div> </body> </html>

Remove the ìfs from lines 4-8

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.