【问题标题】:How to link php file and jsp file如何链接php文件和jsp文件
【发布时间】:2017-10-08 18:04:15
【问题描述】:

我有一个 HTML 页面,我在其中使用 php 进行数据库连接,并且我想将 javascript 的 onchange 事件用于复选框。如何链接 php 文件和 jsp 文件?请提出任何解决方案。

【问题讨论】:

  • 你的意思是你的 php 文件中有一个 html 代码并且你想包含 javascript 文件?
  • @ChiragSwadia 在我的 html 代码中我的表单操作将转到 php 文件
  • 据我所知,JSP 是用java 构建的。与JavaScript无关

标签: javascript php html checkbox


【解决方案1】:

好的,我认为您的意思是 JS 而不是 JSP。如果是这样,这就是您需要做的事情

在您的 PHP 文件中添加以下代码。例如 index.php

<html>
    <head>
        <!-- app.js will contain your javascript with the checkbox logic you want to add -->
        <script type="text/javascript" src="app.js"></script>
    <head>
    <body>
      <form action="./index.php">
         <!-- form elements here -->
      </form>
    </body>
</html>

<?php
   // Your form submission logic and database connectivity code will come here
?>

如果这是您想要实现的目标,请告诉我。

【讨论】:

    猜你喜欢
    • 2014-12-31
    • 2014-03-04
    • 1970-01-01
    • 1970-01-01
    • 2014-02-04
    • 2018-10-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多