【问题标题】:how to insert doublequote inside doublequote on HTML5如何在 HTML5 的双引号内插入双引号
【发布时间】: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="&lt;?php Table("Location"); ?&gt;" ... 没有理由工作由于 PHP 在 HTML 之前很久就被解释了,当然这取决于Table("Location") 的输出实际上是什么。但是,将 include'./Function/DisplayFunction/TableViewer.php'; 嵌入到 formaction 中也只是......很奇怪。
  • 谢谢,但该行在代码上不起作用,我应该使用 AJAX 代码更改我的方法

标签: php html button


【解决方案1】:

包括将把该php文件的所有内容粘贴到formaction属性中,这肯定不是你想要的,试试吧:

<?php
include('./Function/DisplayFuncrion/TableViewer.php');
echo '<button id="Location" type="button" value="LOCATION" formmethod="GET" formaction="'.Table("Location").'" onclick="">LOCATION</button>';
?>

【讨论】:

    【解决方案2】:

    这里不需要使用双引号。

    试试这个

    <button id="Location" type="button" value="LOCATION" formmethod="GET" formaction="<?PHP include('./Function/DisplayFunction/TableViewer.php'); Table('Location%'); ?>" onclick="">LOCATION</button>
    

    【讨论】:

      【解决方案3】:

      使用反斜杠:\ 而不是:/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-02-15
        • 1970-01-01
        • 2022-11-17
        • 2011-04-19
        • 2011-03-09
        • 2013-06-17
        相关资源
        最近更新 更多