添加 php 代码

发布于 2024-12-22 22:06:10 字数 306 浏览 2 评论 0原文

我需要一些帮助才能在这段代码中放置一个简单的 php 标签

$return.="<form method='post' action='#'><input type='submit' value=''><input type='hidden' name='task'></form>";

,我需要放置 php - - 在第一个输入标签中

有人可以帮忙吗?

谢谢

I need some help to put a simple php tag in this code

$return.="<form method='post' action='#'><input type='submit' value=''><input type='hidden' name='task'></form>";

I need to put the php - <?php echo $htmlString; ?> - in the first input tag

Can somebody help please?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

三月梨花 2024-12-29 22:06:10
 $return.="<form method='post' action='#'><input type='submit' value='$htmlString'><input type='hidden' name='task'></form>";
 $return.="<form method='post' action='#'><input type='submit' value='$htmlString'><input type='hidden' name='task'></form>";
将军与妓 2024-12-29 22:06:10

如果您想将其作为值插入到提交按钮,这里是解决方案。

$return.="<form method='post' action='#'><input type='submit' value='$htmlString'><input type='hidden' name='task'></form>";

更新
使用以下代码:就像您想要使用变量 CbText::_('CONFIRM') 一样。

$return.="<form method='post' action='#'><input type='submit' value='" . CbText::_('CONFIRM') . "'><input type='hidden' name='task'></form>";

If you want to insert it as value to submit button here is the solution.

$return.="<form method='post' action='#'><input type='submit' value='$htmlString'><input type='hidden' name='task'></form>";

Update:
Use the following code: as you want to use the variable CbText::_('CONFIRM').

$return.="<form method='post' action='#'><input type='submit' value='" . CbText::_('CONFIRM') . "'><input type='hidden' name='task'></form>";
鸠书 2024-12-29 22:06:10

有两种方法可以做到这一点:

  • 您可以使用以下语法通过 PHP 有条件地打印 HTML 代码:

    <前><代码>

    >
    <输入类型='提交'值='<?php echo $htmlString; ?>'>
    <输入类型='隐藏'名称='任务'>


  • 或者仅通过字符串连接:

    $return .= "
    "; $return .= "<输入类型='提交'值='$htmlString'>"; $return .= "<输入类型='隐藏'名称='任务'>";

There are two ways to do this:

  • You can print HTML code conditionally with PHP using this syntax:

    <?php
    
    // Your code
    
    ?>
    
    <form method='post' action='#'>
      <input type='submit' value='<?php echo $htmlString; ?>'>
      <input type='hidden' name='task'>
    </form>
    
    <?php
    
    // Your code
    
    ?>
    
  • Or just by string concatenation:

    $return .= "<form method='post' action='#'>";
    $return .= "<input type='submit' value='$htmlString'>";
    $return .= "<input type='hidden' name='task'></form>";
    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文