2013-09-26 00:23
浏览 22


I have this form html code in update.php. For updating, it's required to link to another page save_seeker.php with mysql update script for it to be executed. Is there any way to execute the script in same page on submitting form so that after query execution it remains on same page?

  <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>
  <input type = "email" name = "email" value = "<?php echo $disp['email'];?>"><br><br>
  <input type = "text" name = "address" value = "<?php echo $disp['address'];?>"><br><br> 
  <input type = "number" name = "experience" value = "<?php echo $disp['experience'];?> "><br><br> 
  <input type = "text" name = "qualification" value = "<?php echo $disp['qualification'];?>"><br><br>
  <input type = "Submit" value = "Update">
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dstk51319 2013-09-26 00:27

    You could do the processing in the same file by adding this into the form action.

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

    Now check for the submit action by checking if it is set in the post variable

        if ( isset( $_POST['form_submit'] ) ) {
            // Do processing here.
    点赞 打赏 评论
  • dounanyin3179 2013-09-26 00:49

    You could use the include('page-with-update.php') , call the update function and use the $_SERVER["PHP_SELF"].

    I hope helped!!

    点赞 打赏 评论