2种访问类型

时间:2016-07-08 14:48:56

标签: javascript php jquery html css

我正在尝试了解如何使用PHP和MySQL构建用户注册。这是我创建的表单和我编写的一些PHP代码。由于我的注册,我有两种类型的用户(卖方和买方)。我想知道如何为两者进行注册。我已经给出了我想要创建的数据库属性名称。

代码:

    <?php
    include('dbconnection.php');
    ob_start();

    if(isset($_POST['submit']) == true)
    {
        $fullname = mysql_real_escape_string($_POST['fullname']);
        $email = mysql_real_escape_string($_POST['emailadd']);
        $contact = mysql_real_escape_string($_POST['contactno']);
        $pass = md5(mysql_real_escape_string($_POST['pass']));
        $cpass = md5(mysql_real_escape_string($_POST['cpass']));
        $usertype = mysql_real_escape_string($_POST['usertype']);
        $tc = mysql_real_escape_string($_POST['tc']);

        $result_email = mysqli_query($conn, "SELECT * FROM foodbox WHERE mem_email='$memail'");

?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Required meta tags always come first -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Foodbox</title>

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">

    <!-- Custom CSS -->

     <link rel="stylesheet" href="css/header_footer.css">    


  </head>
  <body>
      <nav class="navbar navbar-default" style="background-color: #f9dc79;">
  <div class="container-fluid">
    <div class="navbar-header" >
    <a class="navbar-brand" href="index.html"><img src="img/foodboxlogo1.png" height="38px;" style="position:relative; bottom:7px;"></a>
      <a class="navbar-brand" href="#">Foodbox</a>
    </div>
    <ul class="nav navbar-nav" >
      <li><a href="#">Home</a></li>
      <li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Order by<span class="caret"></span></a>
        <ul class="dropdown-menu">
          <li><a href="#">Restaurants</a></li>
          <li><a href="#">Meals</a></li>

        </ul>
      </li>

    </ul>
    <ul class="nav navbar-nav navbar-right">
      <li><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
      <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
    </ul>
  </div>
</nav>
    <!-- container -->
    <div class="container">



        <div class="row">

            <!-- Article main content -->
            <article class="col-xs-12 maincontent">
                <header class="page-header">
                    <h1 class="page-title">Registration</h1>
                </header>

                <div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <h3 class="thin text-center">Register a new account</h3>
                            <p class="text-center text-muted">Existing User?<a href="signin.html">Login</a> to get more info </p>
                            <hr>

                            <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
                                <div class="top-margin">
                                    <label>Full Name</label>
                                    <input type="text" name="fullname" class="form-control">
                                </div>
                                <span style="color:red"><?php echo (isset($name_error) ? "*" . $name_error : "") ?></span>
                                <div class="top-margin">
                                    <label>Email Address <span class="text-danger">*</span></label>
                                    <input type="email" name="emailadd" class="form-control">
                                </div>
                                <div class="top-margin">
                                    <label>Contact No <span class="text-danger">*</span></label>
                                    <input type="text" name="contactno" class="form-control">
                                </div>

                                <div class="row top-margin">
                                    <div class="col-sm-6">
                                        <label>Password <span class="text-danger">*</span></label>
                                        <input type="password" name="pass" class="form-control">
                                    </div>
                                    <div class="col-sm-6">
                                        <label>Confirm Password <span class="text-danger">*</span></label>
                                        <input type="password" name="cpass" class="form-control">
                                    </div>
                                </div>
                                <span style="color:red"><?php echo (isset($pass_error) ? "*" . $pass_error : "") ?></span>
                                <div class="row">
                                    <div class="col-lg-6 text-left" style="position:relative; right:-20px;">
                                        <label class="radio" >
                                            <input type="radio" name="usertype" value="caterer"> 
                                             <h5>Register as Caterer</h5>
                                        </label>                        
                                    </div>
                                    <div class="col-lg-6">
                                    <label class="radio">
                                            <input type="radio" name="usertype" value="customer"> 
                                             <h5>Register as Customer</h5>
                                        </label> 
                                    </div>
                                </div>

                                <hr>

                                <div class="row">
                                    <div class="col-lg-7 text-left" style="position:relative; right:-20px;">
                                        <label class="checkbox">
                                            <input type="checkbox" name="tc"> 
                                            I've read the <a href="page_terms.html">Terms and Conditions</a>
                                        </label>                        
                                    </div>
                                    <div class="col-lg-5 text-right">
                                        <button class="btn btn-action" type="submit" name="submit">Register</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>

                </div>

            </article>
            <!-- /Article -->

        </div>
    </div>  <!-- /container -->
        <footer id="footer-main">
        <div class="container">
            <div class="row">
                <div class="col-sm-4">
                    <h3>Available Payment</h3>
                    <p>You can pay through Cash on Delivery or online using your Credit Cards</p>

                    <div class="form-inline">
                       <img src="img/cashon.png" alt="A wet spiderweb" height="50px;">
                       <img src="img/visa.png" alt="A wet spiderweb" height="50px;">
                       <img src="img/mastercard.png" alt="A wet spiderweb" height="50px;">
                    </div>

                </div>
                <div class="col-sm-4 " >
                    <h3>Get Touch With Us</h3>
                    <p>Follow us and get in touch with Talabat latest events. </p>

                    <div class="form-inline">

                        <a href=""><img src="img/facebook.png" alt="A wet spiderweb" height="50px;"></a>

                        <a href=""><img src="img/twitter.png" alt="A wet spiderweb" height="50px;"></a>

                        <a href=""><img src="img/linked.png" alt="A wet spiderweb" height="50px;"></a>

                        <a href=""><img src="img/insta.png" alt="A wet spiderweb" height="50px;"></a>
                        <a href=""><img src="img/youtube.png" alt="A wet spiderweb" height="50px;"></a>



                </div>
                </div>
                        <div class="col-sm-4 " >
                    <h3>Contact</h3>


                    <div>

                       <h5>+234 23 9873237<br>
                                <a href="mailto:#">foodbox_delivery@gmail.com</a><br>
                                <br>
                                777 Taman Agenda, Negeri Sembilan 77777
                            </h5>   
                            <a href="#" class="btn btn-default btn-xs" role="button">Privacy & Policy</a>

                       <a href="#" class="btn btn-default btn-xs" role="button">Term & Condition</a>


                </div>
                </div>


        </div>
    </footer>



  <!-- jQuery first, then Bootstrap JS. -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="bootstrap/js/bootstrap.min.js"></script>
  </body>
</html>

0 个答案:

没有答案