drl47263 2014-03-30 05:34
浏览 119
已采纳

我提交表单时找不到页面,但是当我重新加载相同的网址时显示该页面

I am using the following template file to create a new page from wordpress dashboard.

<?php 
  /*
    Template Name: admin info form
  */
?>

<?php 
require_once('includes/Admin_profile.php');
require_once('includes/session.php');

get_header(); 

?>



  <?php 
if(isset($_POST['submit-btn']))
{


   $admin_info=new Admin_profile();
   $admin_info->admin_prof_id=$_SESSION['admin_id'];
   $admin_info->name=$_POST['name'];
   $admin_info->degree=$_POST['degree'];
   $admin_info->school=$_POST['school'];
   $admin_info->college=$_POST['college'];
   $admin_info->uni=$_POST['uni'];
   $admin_info->pres_addr=$_POST['pres_addr'];
   $admin_info->per_addr=$_POST['per_addr'];
   $admin_info->mobile=$_POST['mobile'];
   $admin_info->department=$_POST['dept'];
    $admin_info->save(); 




}


?>
 <div id="admin-login-form"> 
<div class="error_required_fields">Fill up all required fields. * indicated fields are required</div>

  <form name="input" action="#" method="post">
    <table>

      <tr><td> Name:</td><td><input class="name" type="text" name="name" /></td> <td><p class="required">*</p></div></td></tr>
      <tr><td> Last academic degree:</td><td><input class="degree" type="text" name="degree" /></td> <td><p class="required">*</p></td></tr>
      <tr><td> School:</td><td><input class="school" type="text" name="school" /></td><td><p class="required">*</p></td></tr> 
       <tr><td> College:</td><td><input class="college" type="text" name="college" /></td> </tr>
       <tr><td> University:</td><td><input class="uni" type="text" name="uni" /></td> </tr>
       <tr><td>Present Address:</td><td><input class="pres_addr" type="textarea" name="pres_addr" /></td><td><p class="required">*</p></td></tr> 
       <tr><td>Present Address:</td><td><input class="per_addr" type="textarea" name="permanent_addr" /></td> <td><p class="required">*</p></td></tr>
       <tr><td>Mobile number:</td><td><input class="mobile" type="text" name="mobile" /></td> <td><p class="required">*</p></td></tr>  

       <tr><td>Mobile number:</td><td><input class="mobile" type="text" name="mobile" /></td> <td><p class="required">*</p></td></tr> 
       <tr><td>Depertment:</td><td>
       <select name="options">
      <option value="not selected" selected="selected">Choose favorite subject</option>
                <option value="Mathematics">Mathematics</option>
                <option value="Chemestry">Chemestry</option>
                <option value="Biology">Biology</option>

       </select></td>
       <td><p class="required">*</p></td>
       </tr>


      <tr><td> </td><td class="btn"> <input type="submit" class="submit-btn" name="submit-btn" value="Submit" /></td></tr>
    </table> 

</form>

      </div>       


   <?php

    get_footer();
    ?>

But when I submit the form it shows- 404 error (No page found). I notice that url is: http://localhost/wordpress/admin-info/# . I copy this url and paste it in a new tab. Then it show the page. What problem going on. please help.

  • 写回答

2条回答 默认 最新

  • dongzhong6675 2014-03-30 06:10
    关注

    I got solution. Here I used "name" for a name filed of a form. just avoid naming your input fields "name" to avoid this error.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比