【发布时间】:2014-06-02 10:47:53
【问题描述】:
我尝试将 PHP 函数调用到 HTML 5 按钮格式中,当我单击按钮时它不起作用。 这里是第一个代码:
<button id="Location" type="button" value="LOCATION" formmethod="GET" formaction="<?PHP include'./Function/DisplayFunction/TableViewer.php'; Table("Location");?>" onclick="">LOCATION</button>
我试过之后:
<button id="Location" type="button" value="LOCATION" formmethod="GET" formaction="<?PHP include'./Function/DisplayFunction/TableViewer.php'; Table(/"Location/");?>" onclick="">LOCATION</button>
还有这个:
<button id="Location" type="button" value="LOCATION" formmethod="GET" formaction="<?PHP include'./Function/DisplayFunction/TableViewer.php'; Table(%84Location%84);?>" onclick="">LOCATION</button>
【问题讨论】:
-
现在用反斜杠试试
-
能否给出输出的HTML代码?
-
这里不仅仅是一个反斜杠问题 - 它看起来像是对 HTML 和 PHP 如何协同工作的根本误解......
formaction="<?php Table("Location"); ?>" ...没有理由不工作由于 PHP 在 HTML 之前很久就被解释了,当然这取决于Table("Location")的输出实际上是什么。但是,将include'./Function/DisplayFunction/TableViewer.php';嵌入到formaction中也只是......很奇怪。 -
谢谢,但该行在代码上不起作用,我应该使用 AJAX 代码更改我的方法