php - Bootstrap refreshes the page on submit -


i've tried create signup form bootstrap , keep having these problems: page refreshes after click submit button , won't open php file , insert username database.

here code:

<?php  ?>   <!doctype html> <html lang="en">     <head>         <meta charset="utf-8" />         <title>memory line - sign page</title>          <meta name="viewport" content="width=device-width, initial-scale=1.0">         <link rel="stylesheet" href="../bootstrap/css/bootstrap.css">         <link rel="stylesheet" href="../bootstrap/css/bootstrap-responsive.css">     </head>     <body>         <script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>         <script src="../bootstrap/js/bootstrap.js"></script>         <script src="js/sign_up_js.js"></script>         <script src="js/main.js"></script>         <script src="js/ajax.js"></script>             <div class="navbar navbar-fixed-top">             <div class="navbar-inner">                 <div class="container">                     <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">                         <span class="icon-th-list"></span>                     </a>                     <a href="#" class="brand">memory line</a>                     <div class="nav-collapse collapse">                         <ul class="nav pull-right" >                             <li class="active"><a href="#">home</a></li>                             <li class="divider-vertical"></li>                             <li><a href="#">about us</a></li>                             <li class="divider-vertical"></li>                             <li><a href="#">contact</a></li>                         </ul>                     </div>                 </div>             </div>         </div> <!--top navbar-->            <div class="row-fluid">             <div class="span4">                 <div class="well well-large">                     <form>                         <fieldset>                             <h2>login!</h2>                             <input type="text" class="input-block-level" placeholder="username"> <!--username-->                             <input type="text" class="input-block-level" placeholder="password"> <!--password-->                             <button id="sumbit_btn" class="btn btn-primary" type="submit"  >sumbit</button> <!--login btn-->                         </fieldset>                     </form>                 </div>             </div> <!--login form-->               <div class="span8">                 <div class="well well-large">                     <h2>sign up!</h2>                     <form>                         <fieldset>                              <form method="post" action="php_icludes/sign_php.php" >                                       <input type="text" class="input-block-level" placeholder="username" name="username" maxlength="16">                                      <input type="submit" value="submit" />                              </form>                         </fieldset>                     </form>                 </div>             </div>         </div>        </body> </html> 

and here php file inserts data database:

    <?php include_once("db_conx.php");  /* now, select database */ mysql_select_db("database name");  $u = preg_replace('#[^a-z0-9]#i', '', $_post['username']);  $sql = "insert users (username) values('$u')";         $query = mysqli_query($db_conx, $sql);   if($query) { echo "registration succesfull"; } else { echo "error in registration".mysql_error(); }   ?> 

it looks have typo in form action url.

php_icludes/sign_php.php 

i'm guessing should be:

php_includes/sign_php.php 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -