dsu5188 2017-11-21 07:58
浏览 50

Php页面没有处理表单中的操作

I have an html page that contains 2 forms, one for sign up and the other for sign in, and each have a submit button. The problem is that when I click these buttons nothing happens despite that the form action pages have been set. I am using netbeans and wamp server and I tried to run the project directly from the php pages (instead of the html page) and I got the needed response "Connected successfully".

Here is the complete html page :

<!DOCTYPE html>

<html>
<head>
    <title>Sign Up</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"
    integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
    crossorigin="anonymous"></script>

    <!----------------------------------jQuery Validate---------------------------------->
    <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.12.0/jquery.validate.js"></script>
    <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.12.0/additional-methods.js"></script>
    <!------------------------------------------------------------------------------------------------>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" 
    integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" 
    crossorigin="anonymous"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" 
          integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" 
          crossorigin="anonymous">
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" 
    integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" 
    crossorigin="anonymous"></script>
    <!--<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" 
          crossorigin="anonymous">-->
    <!-- Website Font style -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
    <!-- Google Fonts -->
    <link href='https://fonts.googleapis.com/css?family=Passion+One' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Oxygen' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="SignUpStyle.css" type="text/css">
</head>
<body>
    <div class="container">
        <div class="row main">
            <div class="main-login main-center">
                <h5>Sign Up</h5>
                <form action="SignUp.php" method="post" id="signupForm">

                    <div class="form-group">
                        <label for="fn" class="cols-sm-2 control-label">Firstname</label>
                        <div class="cols-sm-10">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"></i></span>
                                <input type="text" class="form-control" name="fn" id="fn"  
                                       placeholder="Enter your firstname"/>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="ln" class="cols-sm-2 control-label">Lastname</label>
                        <div class="cols-sm-10">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"></i></span>
                                <input type="text" class="form-control" name="ln" id="ln"
                                       placeholder="Enter your lastname"/>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="email" class="cols-sm-2 control-label">Email</label>
                        <div class="cols-sm-10">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-envelope fa" aria-hidden="true"></i></span>
                                <input type="email" class="form-control" name="email" id="email" 
                                       placeholder="Enter your Email"/>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="password" class="cols-sm-2 control-label">Password</label>
                        <div class="cols-sm-10">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-lock fa-lg" aria-hidden="true"></i></span>
                                <input type="password" class="form-control" name="password" id="password"  
                                       placeholder="Enter your Password"/>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="confirm" class="cols-sm-2 control-label">Confirm Password</label>
                        <div class="cols-sm-10">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-lock fa-lg" aria-hidden="true"></i></span>
                                <input type="password" class="form-control" name="confirm" id="confirm"  
                                       placeholder="Confirm your Password"/>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <input id="submit" type="submit" value="Register" name="submit" form="signupForm"
                                  class="btn btn-primary btn-lg btn-block login-button">
                        <div id="agreeDiv">
                            <input id="agreeId" type="checkbox" value="agree"/>
                            <label id="agreeLbl">I accept the terms and conditions</label>
                        </div>
                    </div>

                    <div class="form-group">
                        <span id="signInSpan">Already have an account?<button id="signInBtn">Sign In!!</button></span>
                    </div>
                </form>

                <form method="post" action="SignIn.php" id="signinForm">

                    <div class="form-group">
                        <label for="email2" class="cols-sm-2 control-label">Email</label>
                        <div class="cols-sm-10">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-envelope fa" aria-hidden="true"></i></span>
                                <input type="email" class="form-control" name="email2" id="email2" 
                                       placeholder="Enter your Email"/>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="password2" class="cols-sm-2 control-label">Password</label>
                        <div class="cols-sm-10">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-lock fa-lg" aria-hidden="true"></i></span>
                                <input type="password" class="form-control" name="password2" id="password2"  
                                       placeholder="Enter your Password"/>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <button id="submit2" type="submit" class="btn btn-primary btn-lg btn-block login-button">Login</button>
                    </div>

                    <div class="form-group">
                        <span id="signUpSpan">Don't have an account?<button id="signUpBtn">Sign Up!!</button></span>
                    </div>

                </form>
            </div>
        </div>
    </div>
    <script src="SignUpIn.js"></script>
</body>

And that's the signup.php page:

<?php
$servername = "localhost";
$username = "root";
$password = "";
$db = "projetpw";
$port = 3308;
$conn = mysqli_connect($servername, $username, $password, $db ,$port);
if(!$conn){
    die("Connection failed : ".mysqli_connect_error());
}
else{
    $jq = '<script type="text/javascript">'
            . 'alert("Connected Successfully");'
            . '</script>';
    echo $jq;
}

Any help would be appreciated.

  • 写回答

2条回答 默认 最新

  • douao8204 2017-11-21 08:49
    关注

    I think the js file which you included at bottom maybe creating problem, otherwise no issue in submitting a form code.

    <script src="SignUpIn.js"></script>
    
    评论

报告相同问题?

悬赏问题

  • ¥30 酬劳2w元求合作写文章
  • ¥15 在现有系统基础上增加功能
  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 关于#java#的问题:找一份能快速看完mooc视频的代码
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图