首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用php在同一个按钮中创建多个函数或活动?

如何使用php在同一个按钮中创建多个函数或活动?
EN

Stack Overflow用户
提问于 2017-03-28 23:37:03
回答 1查看 44关注 0票数 0

我正在开发一个使用PHP的网站,允许用户登录到系统。但我不知道是什么问题,当用户点击登录按钮,按钮停留在同一页而不是直接转到下一页。

你能帮我找出问题的原因吗?提前谢谢你!

代码语言:javascript
复制
<html lang="en">

<head>
  <form action="login.php" method="post">
    <form action="order.html" method="get">



      <title>bAJu VALeT </title>

      <style>
        @import url(http://fonts.googleapis.com/css?family=Raleway:400,700);
        body {
          background: #7f9b4e url(img/v1.jpg) no-repeat center top;
          -webkit-background-size: cover;
          -moz-background-size: cover;
          background-size: cover;
        }
        
        .container>header h1,
        .container>header h2 {
          color: black;
          text-shadow: 0 3px 3px rgba(0, 0, 0, 0.7);
        }
      </style>
</head>

<body>
  <div class="container">


    <header>

      <center>
        <h1><strong>WELCOME TO </strong> BAJUVALET </h1>
      </center>


    </header>
    <center>
      <section class="main">
        <form class="form-4">
          <h1>LOGIN</h1>
          <p>

            <form id="login" method="POST" class="form-signin" role="form">

              <td>
                <h2>Email:</td>
              <td><input type="text" name="email">
                <h2>
              </td>

              <td>Password:</td>
              <td><input type="text" name="password"></td>



              <form action="order.html" method="post">
                <div <a href="order.html">
                  <td>
                    <h1><input type="submit" name="continue" value="CONTINUE">
                      <h1>

                  </td>


                </div>

              </form>
            </form>



            <label class="checkbox">
        		                	 </p>

				    <p>
						<form action="index.html">				        
												
						</form>
						<div class="login-links"> 
						
					
                                <a href="signup.php">
				                <p>
								<a href="signup.php">
                                  <h6>Don't have an account? <strong>Sign Up</strong><h6>
				                </p>
                                </a>
                            </div>              
                        </div>                      
                   </div>                                       
                </div>
            </div>
        </div>    

        
    </body>

</html>


					
				    </p> 
					</form>	
				</form>​
			  </section>
			</center>
        </div>


    </body>
</html>

EN

回答 1

Stack Overflow用户

发布于 2017-03-29 01:33:00

我不知道你为什么会有这么多的<form>标签,但是根据我从你的代码中推断出来的,你可能正在寻找类似这样的东西:

代码语言:javascript
复制
<html lang="en">

<head>

    <title>bAJu VALeT </title>

    <style>

    @import url(http://fonts.googleapis.com/css?family=Raleway:400,700);

    body {
      background: #7f9b4e url(img/v1.jpg) no-repeat center top;
      -webkit-background-size: cover;
      -moz-background-size: cover;
      background-size: cover;
    }

    .container>header h1,
    .container>header h2 {
      color: black;
      text-shadow: 0 3px 3px rgba(0, 0, 0, 0.7);
    }

    </style>

</head>

<body>

    <div class="container">

        <header>
            <center>
                <h1><strong>WELCOME TO</strong>BAJUVALET</h1>
            </center>
        </header>

        <center>

        <section class="main">

            <h1>LOGIN</h1>

            <p></p>

            <form id="login" class="form-signin" role="form" method="POST" action="order.php">

                <table border="1" cellpadding="">

                    <tr>
                        <td><h2>Email:</h2></td>
                        <td><input type="text" name="email"></td>
                    </tr>

                    <tr>
                        <td><h2>Password:</h2></td>
                        <td><input type="text" name="password"></td>
                    </tr>

                    <tr>
                        <td colspan="2">
                            <center>
                            <input type="submit" name="continue" value="CONTINUE">
                            </center>
                        </td>
                    </tr>

                </table>

            </form>

            <a href="signup.php">
                <h6>Don't have an account? <strong>Sign Up</strong></h6>
            </a>

            <p></p>

        </section>

    </div>

</body>

然后在order.php

代码语言:javascript
复制
<?php

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

echo "Email: ".$email." Password: ".$password.".<br/>";

?>

现在,一些重要的建议需要牢记在心:

  1. 记住关闭您打开的标记,这是一个很好的做法,可以在您的代码增长时为您节省大量时间;
  2. 使用适当的缩进,它使您的代码更容易阅读,从而为您正在尝试学习的文档改进productivity;
  3. Search。在这种情况下,查找"html
  4. documentation“可以帮助您解决问题并了解所发生的事情。

有用的链接:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43073899

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档