2017-03-23 07:15
浏览 381

如何使用HTML按钮单击调用PHP函数? [关闭]

I am a beginner with HTML and PHP and i am having problems with my code. all I need to do is to call a particular function on the button click in html. both the fuction and html are on same page. whenever i run this this doesn't generate the required output. I shall be very thankful for help. please help as soon as possiblemyfirstpage.php

图片转代码服务由CSDN问答提供 功能建议

我是HTML和PHP的初学者,我的代码出现问题。 我需要做的就是在html按钮上调用一个特定的函数。 功能和html都在同一页面上。 每当我运行它时,这不会产生所需的输出。 我非常感谢你的帮助。 请尽快帮助 myfirstpage.php

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

3条回答 默认 最新

  • dongxing1412 2017-03-23 07:20

    Like this?

      if (isset($_POST['submit'])) {
      function someFunction() {
        echo 'HI';
    <!DOCTYPE html>
    <html lang="en">
        <meta charset="UTF-8">
        <form action="" method="POST">
          <input type="submit" name="submit">

    Although quite weird, this will work, you can use $_GET if you want

    解决 无用
    打赏 举报

相关推荐 更多相似问题