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条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度