<small id='Oh9OA'></small><noframes id='Oh9OA'>

<tfoot id='Oh9OA'></tfoot>
<legend id='Oh9OA'><style id='Oh9OA'><dir id='Oh9OA'><q id='Oh9OA'></q></dir></style></legend>

      • <bdo id='Oh9OA'></bdo><ul id='Oh9OA'></ul>

        <i id='Oh9OA'><tr id='Oh9OA'><dt id='Oh9OA'><q id='Oh9OA'><span id='Oh9OA'><b id='Oh9OA'><form id='Oh9OA'><ins id='Oh9OA'></ins><ul id='Oh9OA'></ul><sub id='Oh9OA'></sub></form><legend id='Oh9OA'></legend><bdo id='Oh9OA'><pre id='Oh9OA'><center id='Oh9OA'></center></pre></bdo></b><th id='Oh9OA'></th></span></q></dt></tr></i><div id='Oh9OA'><tfoot id='Oh9OA'></tfoot><dl id='Oh9OA'><fieldset id='Oh9OA'></fieldset></dl></div>

        在按钮单击时运行 php 函数

        时间:2023-12-01
        <legend id='FIMgn'><style id='FIMgn'><dir id='FIMgn'><q id='FIMgn'></q></dir></style></legend>

      1. <tfoot id='FIMgn'></tfoot>

        <small id='FIMgn'></small><noframes id='FIMgn'>

            <tbody id='FIMgn'></tbody>

              <bdo id='FIMgn'></bdo><ul id='FIMgn'></ul>
                  <i id='FIMgn'><tr id='FIMgn'><dt id='FIMgn'><q id='FIMgn'><span id='FIMgn'><b id='FIMgn'><form id='FIMgn'><ins id='FIMgn'></ins><ul id='FIMgn'></ul><sub id='FIMgn'></sub></form><legend id='FIMgn'></legend><bdo id='FIMgn'><pre id='FIMgn'><center id='FIMgn'></center></pre></bdo></b><th id='FIMgn'></th></span></q></dt></tr></i><div id='FIMgn'><tfoot id='FIMgn'></tfoot><dl id='FIMgn'><fieldset id='FIMgn'></fieldset></dl></div>
                1. 本文介绍了在按钮单击时运行 php 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I want to run a php function on button click. for eg :

                  <input type="button" name="test" id="test" value="RUN"  onclick="<?php echo testfun(); ?>" /><br/>
                  
                  <?php
                  
                  function testfun()
                  {
                     echo "Your test function on button click is working";
                  }
                  
                  ?>
                  

                  My question is that when I do this I don't get the expected output I was looking for. Please give me the best solution for this to run a php function on button click whether it is a simple button or submit.

                  解决方案

                  I tried the code of William, Thanks brother.

                  but it's not working as a simple button I have to add form with method="post". Also I have to write submit instead of button.

                  here is my code below..

                  <form method="post">
                      <input type="submit" name="test" id="test" value="RUN" /><br/>
                  </form>
                  
                  <?php
                  
                  function testfun()
                  {
                     echo "Your test function on button click is working";
                  }
                  
                  if(array_key_exists('test',$_POST)){
                     testfun();
                  }
                  
                  ?>
                  

                  这篇关于在按钮单击时运行 php 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何使用 jquery 对 php 文件进行 onclick ajax 调用? 下一篇:在不离开当前页面的情况下从 Javascript 调用 PHP 脚本

                  相关文章

                    <small id='VB06d'></small><noframes id='VB06d'>

                    <legend id='VB06d'><style id='VB06d'><dir id='VB06d'><q id='VB06d'></q></dir></style></legend>
                      • <bdo id='VB06d'></bdo><ul id='VB06d'></ul>

                      <i id='VB06d'><tr id='VB06d'><dt id='VB06d'><q id='VB06d'><span id='VB06d'><b id='VB06d'><form id='VB06d'><ins id='VB06d'></ins><ul id='VB06d'></ul><sub id='VB06d'></sub></form><legend id='VB06d'></legend><bdo id='VB06d'><pre id='VB06d'><center id='VB06d'></center></pre></bdo></b><th id='VB06d'></th></span></q></dt></tr></i><div id='VB06d'><tfoot id='VB06d'></tfoot><dl id='VB06d'><fieldset id='VB06d'></fieldset></dl></div>
                      <tfoot id='VB06d'></tfoot>