我希望能够动态插入HTML标记,首先将其复制到textarea,然后再提交。
这是我的第一次尝试。
<!DOCTYPE html>
<html>
<head>
<title>Tag Parser</title>
</head>
<body>
<form name="tagInput" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Input Tags:<br>
<textarea name="tag" id="tag">
</textarea>
<br><br>
<input type="submit" name="send" id="send" value="Submit">
</form>
<?php
foreach ($_POST as $key => $value) {
$value = str_replace('"', "'", $value);
echo "field " . $key . " " . "value " . htmlentities($value) . "<br>";
echo "$value";
}
?>
</body>
</html>
当我输出带有htmlentities()的标签时,我发现它已正确格式化,就像我喜欢它显示,但渲染。但是,第二个回声是添加标签,但是已经坏了。
这是我的意见:
<IFRAME SRC="http://ad.doubleclick.net/adi/N7480.147698OMGBLOG1/B8174590.109702939;sz=300x250;ord=[timestamp]?" WIDTH=300 HEIGHT=250 MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR='#000000'> <SCRIPT language='JavaScript1.1' SRC="http://ad.doubleclick.net/adj/N7480.147698OMGBLOG1/B8174590.109702939;abr=!ie;sz=300x250;ord=[timestamp]?"> </SCRIPT> <NOSCRIPT> <A HREF="http://ad.doubleclick.net/jump/N7480.147698OMGBLOG1/B8174590.109702939;abr=!ie4;abr=!ie5;sz=300x250;ord=[timestamp]?"> <IMG SRC="http://ad.doubleclick.net/ad/N7480.147698OMGBLOG1/B8174590.109702939;abr=!ie4;abr=!ie5;sz=300x250;ord=[timestamp]?" BORDER=0 WIDTH=300 HEIGHT=250 ALT="Advertisement"></A> </NOSCRIPT> </IFRAME>
这是网站中生成的内容:
<iframe src="" width="300" height="250" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" bordercolor="#000000"> <SCRIPT language='JavaScript1.1' SRC='http://ad.doubleclick.net/adj/N7480.147698OMGBLOG1/B8174590.109702939;abr=!ie;sz=300x250;ord=[timestamp]?'> </SCRIPT> <NOSCRIPT> <A HREF='http://ad.doubleclick.net/jump/N7480.147698OMGBLOG1/B8174590.109702939;abr=!ie4;abr=!ie5;sz=300x250;ord=[timestamp]?'> <IMG SRC='http://ad.doubleclick.net/ad/N7480.147698OMGBLOG1/B8174590.109702939;abr=!ie4;abr=!ie5;sz=300x250;ord=[timestamp]?' BORDER=0 WIDTH=300 HEIGHT=250 ALT='Advertisement'></A> </NOSCRIPT> </iframe>
src =为空,标签明显坏了(没有呈现任何内容)