2016-11-18 77 views
2

下面的代碼給出了我創建,但不幸的是,提交按鈕不起作用我看了一些以前的堆棧溢出的文章,並進行了更改,但它不工作,註冊表單bootsrap形式提交按鈕不起作用

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <!-- Theme Made By www.w3schools.com - No Copyright --> 
    <title>Arsiri Textile </title> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
    <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css"> 
    <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css"> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
    <link rel="stylesheet" type="text/css" href="css/basic.css"> 
    <style> 

    </style> 
</head> 
<body id="myPage" data-spy="scroll" data-target=".navbar" data-offset="60"> 




<div class="header" style="height:60px;background:#330d00;width:1350px"> 


     <a class="navbar-brand" href="#myPage">ARSIRI TEXTILE |</a> 


     <ul class="nav navbar-nav navbar-left"> 


     </ul> 
     <ul class="nav navbar-nav navbar-right"> 

     <li><a href="#">About Us</a></li> 
      <li><a href="#">Contact Us</a></li> 
      <li><a href="">Login</a></li> 
     <li><a href="#"> Signup</a></li> 

     </ul> 
    </div> 


<div class="image" style="height:530px; width:1350px" > 
    <!doctype html> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" /> 
<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css" /> 

</head> 
<body> 
<div class="panel panel-default"> 
<div class="panel-heading" style="background:#330d00;"> 
    <h3 class="panel-title">Customer Registration</h3><br> 
</div> 
    <div class="panel-body" > 
<form class="form-horizontal" role="form" action="signup.php" method="post" > 
    <div class="form-group"> 
    <label for="name" class="col-sm-2 control-label">First Name</label> 
    <div class="col-sm-10" style="width:300px"> 
     <input type="text" class="form-control" id="name" name="firstname"> 
    </div> 
    </div> 

     <div class="form-group"> 
    <label for="name" class="col-sm-2 control-label">Last Name</label> 
    <div class="col-sm-10" style="width:300px"> 
     <input type="text" class="form-control" id="name" name="lastname"> 
    </div> 
    </div> 
    <div class="form-group"> 
    <label for="name" class="col-sm-2 control-label">E-Mail</label> 
    <div class="col-sm-10" style="width:300px"> 
     <input type="email" class="form-control" id="name" name="emailaddress"> 
    </div> 
    </div> 
    <div class="form-group"> 
    <label for="name" class="col-sm-2 control-label">Contact No.</label> 
    <div class="col-sm-10" style="width:300px"> 
     <input type="email" class="form-control" id="name" name="contactno"> 
    </div> 
    </div> 

     <div class="form-group"> 
    <label for="Address" class="col-sm-2 control-label">Address</label> 
     <div class="col-sm-10" style="width:300px"> 
<textarea name="" cols="" rows="" class="form-control" name="address"></textarea> 
    </div> 
    </div> 

    <div class="form-group"> 
    <label for="password" class="col-sm-2 control-label">Password</label> 
     <div class="col-sm-10" style="width:300px"> 
     <input type="password" class="form-control" id="pass" name="password"> 
    </div> 
    </div> 
    <div class="form-group"> 
    <label for="password" class="col-sm-2 control-label">Confirm password 
    </label> 
     <div class="col-sm-10" style="width:300px"> 
     <input type="password" class="form-control" id="confirmpass" name="cpassword"><br> 
    </div> 
    </div> 



</form> 
    </div> 
    <div class="panel-footer" style="overflow:hidden;text-align:left;"> 

    <div class="col-sm-offset-2 col-sm-10"> 
     <input class="btn btn-success btn-sm" type=submit name=submit value=Submit > 
<input class="btn btn-success btn-sm" type=reset name=reset value=Cancel> 

    </div> 
    </div> 
    </div> 
</div> 
</body> 

</div> 




<div class="footer " style="background:#330d00; height:60px ;width:1350px "> 
<p align="center" > Asiri all rights reserved</p> 
</div> 

的signupaction.php腳本如下

<?php 

//importing db.php in the includes folder 
require("includes/db.php"); 


$fname=$_POST["firstname"]; 
$lname=$_POST["lastname"]; 
$email=$_POST["emailaddress"]; 
$address=$_POST["address"]; 
$contact=$_POST["contactno"]; 


$password=$_POST["password"]; 
$cpassword=$_POST["cpassword"]; 



$sql="INSERT INTO signup (FName,LName,Address,Contact,Email,Password,CPassword) VALUES ('$fname','$lname','$address','$contact','$email','$password',$cpassword')"; 



$result=mysqli_query($db,$sql); 

if(!$result){ 
    echo "Unsuccessful signup"; 
} 
else{ 
    echo "Successful signup"; 
} 




?> 

請幫我改正這個!當我點擊提交按鈕出現在URL沒有變化,所以我覺得pproblem在signupform

回答

2
<form class="form-horizontal" role="form" action="signup.php" method="post" > 

行動=「signup.php」將重定向形式的頁面signup.php 看來你想要重定向到別的地方?

您也可能想在表單內部提交按鈕,而不是在其外部?

</div> 
    <div class="panel-footer" style="overflow:hidden;text-align:left;"> 

    <div class="col-sm-offset-2 col-sm-10"> 
     <input class="btn btn-success btn-sm" type=submit name=submit value=Submit > 
<input class="btn btn-success btn-sm" type=reset name=reset value=Cancel> 

    </div> 
</form> 
+0

感謝名單,現在很多的形式工作,但不幸的是我得到的錯誤「未定義指數:在H地址:\ xampnew \ htdocs中\ phpfinal \ signupaction.php第10行」我怎樣才能coreect呢? –

+0

檢查你的變量和sql –

+0

是的,它是aso糾正,但不幸的是,雖然沒有錯誤,現在我收到郵件不成功的註冊,因爲查詢失敗:( –