简体   繁体   English

我的表格未能提交

[英]my form failed to be submitted

I have the following code which works by itself but when I try it on wordpress, it shows the login but when I click on submit, it does not submit the form, and goes to following address and shows a white page. 我有以下代码可以单独工作,但是当我在wordpress上尝试时,它显示登录名,但是当我单击“提交”时,它不提交表单,而是转到以下地址并显示白页。

    http://localhost:8080/wordpress/wp-admin/admin.php


    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
              Username <input type="text" name="username"  />
              <br /> 
              Password <input type="password" name="password" />
              <br />
             <input type="submit" value="Login" />

    <?php 
        if(isset($_POST["username"])
        ....

You should perhaps go into more detail of what you are trying to achieve. 您也许应该更详细地说明要实现的目标。

Any reason you are not using wp_login_form() ? 有什么原因不使用wp_login_form()

As for the white screen, I would also recommend to turn on debugging, inside your wp-config.php file is the line define('WP_DEBUG', false); 至于白屏,我还建议您打开调试,在wp-config.php文件中的是define('WP_DEBUG', false); . Change that to true. 将其更改为true。 ( I can only also assume the login showed a white screen because of missing nonce fields, which would go away with using wp_login_form() ) (我也只能假定由于缺少随机数字段而导致登录显示白屏,而使用wp_login_form()会消失)

在表单字段中添加名称属性

<form method="post" name="form_name" action="<?php echo $_SERVER['PHP_SELF']; ?>">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM