表格不提交任何内容

时间:2015-10-06 05:47:39

标签: php html forms

嗨,我是网络开发的新手。我有一个更改密码表单,我试图调用API,但在此之前,表单似乎没有提交任何数据。贝娄是用于检查帖子的表格和支票,但它不会给我任何回报。

<form name="passwordForm" method="post">
<div class="password-form">
     <label>New Password:<span class="small-label"> Please enter at least 8 alphanumeric characters</span></label><input class="changepwd" type="password" name="newPassword1" required=""
      id="newPassword1" placeholder="Password"> <br>
<label>Re-type Password:</label><input class="retypepwd " type="password" name="newPassword2" required="" id="newPassword2" placeholder="Password">

     <button type="submit" value="Change Password" id="changePassword" class="buttonlink">Change
      Password</button>
    </form></div>

<?php 
if(isset($_POST['passwordForm'])){
       echo 'test';
?>

3 个答案:

答案 0 :(得分:0)

试试这个

    <form  method="post">
    <div class="password-form">
         <label>New Password:<span class="small-label"> Please enter at least 8 alphanumeric characters</span></label><input class="changepwd" type="password" name="newPassword1" required=""
          id="newPassword1" placeholder="Password"> <br>
    <label>Re-type Password:</label><input class="retypepwd " type="password" name="newPassword2" required="" id="newPassword2" placeholder="Password">

         <button type="submit" name="passwordForm" value="Change Password" id="changePassword" class="buttonlink">Change
          Password</button>
        </form></div>

    <?php 
    if(isset($_POST['passwordForm'])){
           echo 'test';
}
    ?>

答案 1 :(得分:0)

试试这个..

<form name="passwordForm" method="post">
<div class="password-form">
 <label>New Password:<span class="small-label"> Please enter at least 8 alphanumeric characters</span></label><input class="changepwd" type="password" name="newPassword1" required="" id="newPassword1" placeholder="Password"> <br>
 <label>Re-type Password:</label><input class="retypepwd " type="password" name="newPassword2" required="" id="newPassword2" placeholder="Password">

 <button type="submit" name="cmd_submit" value="Change Password" id="changePassword" class="buttonlink">Change
  Password</button>
</form></div>



<?php 
if(isset($_POST['cmd_submit'])){
   echo 'test';
 }
?>

答案 2 :(得分:0)

试试这个

<div class="password-form">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
     <label>New Password:<span class="small-label"> Please enter at least 8    alphanumeric characters</span></label>
     <input class="changepwd" type="password" name="newPassword1" required="" id="newPassword1" placeholder="Password"> <br>
     <label>Re-type Password:</label>
     <input class="retypepwd " type="password" name="newPassword2" required="" id="newPassword2" placeholder="Password">

     <button type="submit" name="passwordForm" value="Change Password" id="changePassword" class="buttonlink">Change Password</button>
</form>
</div>

<?php 
if(isset($_POST['passwordForm'])){
       echo 'test';
}
?>