0

我在 update.php 中有这个表单 html 代码。对于更新,需要使用 mysql 更新脚本链接到另一个页面 save_seeker.php 才能执行。有没有办法在提交表单时在同一页面中执行脚本,以便在查询执行后它仍然在同一页面上?

  <form action= "save_seeker.php" method = "post">
  Update details !<br><br>
  First Name
  <input type = "text" name = "fname" value = "<?php echo $disp['fname'];?>"><br><br> 
  Last Name 
  <input type = "text" name = "lname" value = "<?php echo $disp['lname'];?>"><br><br>
  Contact number
  <input type = "text" name = "contact" value = "<?php echo $disp['contact'];?>"><br><br>
  Email-id
  <input type = "email" name = "email" value = "<?php echo $disp['email'];?>"><br><br>
  Address
  <input type = "text" name = "address" value = "<?php echo $disp['address'];?>"><br><br> 
  Experience
  <input type = "number" name = "experience" value = "<?php echo $disp['experience'];?> "><br><br> 
  Qualification
  <input type = "text" name = "qualification" value = "<?php echo $disp['qualification'];?>"><br><br>
  <input type = "Submit" value = "Update">
  </form>   
4

2 回答 2

2

您可以通过将其添加到表单操作中来在同一文件中进行处理。

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
    <!-- Input fields in here-->
    <input type="submit" name="form_submit" value="Submit">
</form>

现在通过检查是否在 post 变量中设置来检查提交操作

<?php 
    if ( isset( $_POST['form_submit'] ) ) {
        // Do processing here.
    }
?>
于 2013-09-26T00:27:04.293 回答
-1

您可以使用include('page-with-update.php'),调用更新函数并使用 $_SERVER["PHP_SELF"]。

我希望有所帮助!

于 2013-09-26T00:49:42.103 回答