Bootstrap 3:使用Modal发布到php

时间:2015-05-21 14:36:22

标签: php twitter-bootstrap

我对php和Bootstrap相对较新,我正在尝试使用模式注册并向我的数据库添加新用户,但信息似乎没有发布到php端。请帮我。 以下是注册模式:

                <form class = "form-horizontal" action="index.php" method="post"> 
                    <div class = "modal-header">
                    </div>
                    <div class = "modal-body">
                        <div class = "form-group" >
                            <label for = "user-name" class = "col-lg-2 control-lable">UserName:</label>
                            <div class = "col-lg-10">
                                <input type = "text" class ="form-control" id = "user-name" placeholder = "Username ">
                            </div>
                        </div>

                        <div class = "form-group" >
                            <label for = "password" class = "col-lg-2 control-lable">Password:</label>
                            <div class = "col-lg-10">
                                <input type = "password" class ="form-control" id = "password" placeholder = "Password">
                            </div>
                        </div>  

                        <div class = "form-group" >
                            <label for = "firstname" class = "col-lg-2 control-lable">FirstName:</label>
                            <div class = "col-lg-10">
                                <input type = "text" class ="form-control" id = "firstname" placeholder = "First Name">
                            </div>
                        </div>    

                        <div class = "form-group" >
                            <label for = "othername" class = "col-lg-2 control-lable">OtherName:</label>
                            <div class = "col-lg-10">
                                <input type = "text" class ="form-control" id = "othername" placeholder = "Other Name (If Any)">
                            </div>
                        </div> 

                        <div class = "form-group" >
                            <label for = "lastname" class = "col-lg-2 control-lable">LastName:</label>
                            <div class = "col-lg-10">
                                <input type = "text" class ="form-control" id = "lastname" placeholder = "Last Name">
                            </div>
                        </div>

                        <div class = "form-group" >
                            <label for = "alias" class = "col-lg-2 control-lable">Alias:</label>
                            <div class = "col-lg-10">
                                <input type = "text" class ="form-control" id = "alias" placeholder = "Your Alias">
                            </div>
                        </div>   

                        <div class = "form-group" >
                            <label for = "email" class = "col-lg-2 control-lable">Email:</label>
                            <div class = "col-lg-10">
                                <input type = "text" class ="form-control" id = "email" placeholder = "someone@example.com">
                            </div>
                        </div>

                        <div class = "form-group" >
                            <label for = "city" class = "col-lg-2 control-lable">City:</label>
                            <div class = "col-lg-10">
                                <input type = "text" class ="form-control" id = "city" placeholder = "City">
                            </div>
                        </div>

                        <div class = "form-group" >
                            <label for = "ecountry" class = "col-lg-2 control-lable">Country:</label>
                            <div class = "col-lg-10">
                                <select name = "country" id= "country" >
                                    <option value="Yemen" title="Yemen">Yemen</option>
                                    <option value="Zambia" title="Zambia">Zambia</option>
                                    <option value="Zimbabwe" title="Zimbabwe">Zimbabwe</option>
                                </select>
                            </div>
                        </div>

                    </div>
                    <div class = "modal-footer">
                        <div class = "form-group" >
                        <input class = "btn btn-danger" type = "submit" name = "register" value = "Register">
                        <a class = "btn btn-default" data-dismiss = "modal">Cancel</a>
                    </div>
                    </div>
                    </form>
            </div>
        </div>
    </div>

1 个答案:

答案 0 :(得分:0)

请在点击按钮后检查控制台日志是否有任何错误或什么错误。如果表单已提交,则会将其发布到&#39; action =&#34; index.php&#34;&#39 ;

您在编写用户插入代码的位置?

在index.php中的

只需打印下面的所有帖子值,你就会知道表格是否已发布,

&#13;
&#13;
if(isset($_POST)) {
 var_dump($_POST); exit;
}
&#13;
&#13;
&#13;