靴子表单提交按钮不起作用 [英] bootsrap form submit button not working

查看:98
本文介绍了靴子表单提交按钮不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码给出了我创建的注册表单,但不幸的是提交按钮不起作用,我阅读了一些以前的堆栈溢出文章并进行了更改,但它无效

 <!DOCTYPE html> 
< html lang =en>
< head>
<! - 主题由www.w3schools.com制作 - 无版权 - >
< title> Arsiri Textile< / title>
< meta charset =utf-8>
< meta name =viewportcontent =width = device-width,initial-scale = 1>
< link rel =stylesheethref =https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css>
< link href =https://fonts.googleapis.com/css?family=Montserrat =stylesheettype =text / css>
< link href =https://fonts.googleapis.com/css?family=Lato =stylesheettype =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 =stylesheettype =text / csshref =css / basic.css>
< style>

< / style>
< / head>
< body id =myPagedata-spy =scrolldata-target =。navbardata-offset =60>




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


< a class =navbar-brandhref =#myPage> ARSIRI TEXTILE |< / a>


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


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

< li>< a href =#>关于我们< / a>< / li>
< li>< a href =#>联络我们< / a>< / li>
< li>< a href =>登入< / a>< / li>
< li>< a href =#>注册与LT; / A>< /锂>

< / ul>
< / div>


< div class =imagestyle =height:530px; width:1350px>
<!doctype html>
< html>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = iso-8859-1/>
< link rel =stylesheettype =text / csshref =css / bootstrap.min.css/>
< link rel =stylesheettype =text / csshref =css / bootstrap-theme.min.css/>

< / head>
< body>
< div class =panel panel-default>
< div class =panel-headingstyle =background:#330d00;>
< h3 class =panel-title>客户注册< / h3>< br>
< / div>
< div class =panel-body>
< form class =form-horizo​​ntalrole =formaction =signup.phpmethod =post>
< div class =form-group>
< label for =nameclass =col-sm-2 control-label>名字< / label>
< div class =col-sm-10style =width:300px>
< input type =textclass =form-controlid =namename =firstname>
< / div>
< / div>

< div class =form-group>
< label for =nameclass =col-sm-2 control-label> Last Name< / label>
< div class =col-sm-10style =width:300px>
< input type =textclass =form-controlid =namename =lastname>
< / div>
< / div>
< div class =form-group>
< label for =nameclass =col-sm-2 control-label>电子邮件< / label>
< div class =col-sm-10style =width:300px>
< input type =emailclass =form-controlid =namename =emailaddress>
< / div>
< / div>
< div class =form-group>
< label for =nameclass =col-sm-2 control-label>联络电话号码< / label>
< div class =col-sm-10style =width:300px>
< input type =emailclass =form-controlid =namename =contactno>
< / div>
< / div>

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

< div class =form-group>
< label for =passwordclass =col-sm-2 control-label>密码< / label>
< div class =col-sm-10style =width:300px>
< input type =passwordclass =form-controlid =passname =password>
< / div>
< / div>
< div class =form-group>
< label for =passwordclass =col-sm-2 control-label>确认密码
< / label>
< div class =col-sm-10style =width:300px>
< input type =passwordclass =form-controlid =confirmpassname =cpassword>< br>
< / div>
< / div>



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

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

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

< / div>




< div class =footerstyle =background:#330d00; height:60px; width:1350px>
< p align =center> Asiri保留所有权利< / p>
< / div>

signupaction.php脚本如下

 <?php 

//在包含文件夹中导入db.php
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];


$ b $ sql =插入注册(FName,LName,地址,联系人,电子邮件,密码,CPassword)VALUES('$ fname','$ lname', '$地址', '$联系', '$电子邮件', '$密码',$ cpassword');



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

if(!$ result){
echo不成功注册;
}
else {
echo成功注册;
}




?>

请帮我解决这个问题!当我点击提交按钮时,网址没有变化,所以我认为pproblem是在signupform中的。 < form class =form-horizo​​ntalrole =formaction =signup.phpmethod =post>

action =signup.php会将表单重定向到页面signup.php
它似乎你希望它重定向到别的地方?

你也许想要在你的表单内的提交按钮,而不是外面?

 < / div> 
< div class =panel-footerstyle =overflow:hidden; text-align:left;>

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

< / div>
< / form>


The following code gives a signup form that i created but unfortunately the submit buttons do not work i read some previous stack overflow articles and made changes but it does not work

<!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>

The signupaction.php script is as follows

<?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";
}




?>

Please help me to correct this! When i click the submit button there is no change in the URL so i think the pproblem is in the signupform

解决方案

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

action="signup.php" will redirect the form to the page signup.php it seems you want it to redirect somewhere else?

You also probably want the submit button inside your form, not outside of it?

  </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>

这篇关于靴子表单提交按钮不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆