doujiang6944 2013-09-26 00:23
浏览 22
已采纳

在同一页面中查询执行php脚本

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>
  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>   
  • 写回答

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">
    </form>
    

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

    <?php 
        if ( isset( $_POST['form_submit'] ) ) {
            // Do processing here.
        }
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程