加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – echo显示$content

发布时间:2020-12-13 16:52:51 所属栏目:PHP教程 来源:网络整理
导读:我的问题的简短例子: $myname = "Blah Blah";$content = "tabletrtd".$myname."/td/tr/table";?phpecho "tabletrtd".$myname."/td/tr/tableform name='makepdf' action='make_pdf.php?content=$content' method='POST'button class='cupid-green' name='sub
我的问题的简短例子:

$myname = "Blah Blah";

$content = "<table><tr><td>".$myname."</td></tr></table>";

<?php
echo "<table><tr><td>".$myname."</td></tr></table><form name='makepdf' action='make_pdf.php?content=$content' method='POST'><button class='cupid-green' name='submitpdf'>Prenos PDF</button></form>";
?>

我稍后会在make_pdf.php文件中捕获$content …

但问题是我得到了双重显示内容,其中显示了回声.但是如果我改变action =’make_pdf.php?content = test’就可以了.我还在make_pdf.php中捕获$content.

我试图做:

<input type='hidden' name='content' value='$content'>

我得到类似或更糟的结果,因为我没有抓住$content = $_GET [‘content’];在make_pdf.php中

有解决方案吗

解决方法

用PHP

<?php echo "<input type='hidden' name='content' value='" . $content . "'>";

?>

在HTML中

<input type="hidden" name="content" value="<?php echo htmlspecialchars($content); ?>">

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读