Javascript stripslashes()在iframe提交后删除我的src
我有以下表格:Javascript stripslashes()在iframe提交后删除我的src,javascript,php,html,iframe,stripslashes,Javascript,Php,Html,Iframe,Stripslashes,我有以下表格: <form action="my_parse_file.php" name="myform" id="myform" method="post"> <input placeholder="Entry Title" style="height: 25px; text-align: center; font-size: 12px; background-color: #151515; color: #B4B4B4; border: 1px solid #30
<form action="my_parse_file.php" name="myform" id="myform" method="post">
<input placeholder="Entry Title" style="height: 25px; text-align: center; font-size: 12px; background-color: #151515; color: #B4B4B4; border: 1px solid #303030;"
name="title" id="title" type="text" size="80" maxlength="80" />
<br />
<p>
Entry Body:<br />
<div id="wysiwyg_cp" style="padding: 8px; width: 700px; margin: 0px auto;">
<input class="BTN2" type="button" onclick="iBold()" value="B" />
<input class="BTN2" type="button" onclick="iUnderline()" value="U" />
<input class="BTN2" type="button" onclick="iItalic()" value="I" />
<input class="BTN2" type="button" onclick="iFontSize()" value="Text Size" />
<input class="BTN2" type="button" onclick="iForeColor()" value="Text Color" />
<input class="BTN2" type="button" onclick="iHorizontalRule()" value="HR" />
<input class="BTN2" type="button" onclick="iUnorderedList()" value="UL" />
<input class="BTN2" type="button" onclick="iOrderedList()" value="OL" />
<input class="BTN2" type="button" onclick="iLink()" value="Link" />
<input class="BTN2" type="button" onclick="iUnLink()" value="UnLink" />
<input class="BTN2" type="button" onclick="iImage()" value="Image" />
<input class="BTN2" type="button" onclick="iVideo()" value="Embed Video" />
</div>
<!-- Hide (but keep) your normal textarea and place it in the iFrame replacement for it -->
<textarea style="display: none;" name="myTextArea" id="myTextArea" cols="100" rows="14"></textarea>
<iframe onload="this.contentWindow.focus()" name="richTextField" id="richTextField" style="border: 1px solid #303030; background-color: #151515; width: 700px; height: 300px;"></iframe>
<!-- End replacing your normal textarea -->
</p>
<br />
<br />
<input name="myBtn" type="button" value="Submit Data" onclick="javascript: submit_form();" />
</form>
这是my_parse_file.php:
<?php
echo '<h2>You posted:</h2><hr/>'.$_POST['title'].'<hr/>'.stripslashes($_POST['myTextArea']);
?>
这个也不好
我该怎么做才能得到一个干净的src
原src:
//player.vimeo.com/video/15077261
期望输出:
<iframe src="//player.vimeo.com/video/15077261" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
我想出来了。似乎\是需要删除的额外字符。所以我用str_replace替换了它
echo '<h2>You posted:</h2><hr/>'.$_POST['title'].'<hr/>'.str_replace('\"','',$_POST['myTextArea']);
原始的src是?我把它放在文章的末尾。好的,期望输出?我希望这就是你所说的期望输出。。。我把它放在邮局了
src="\"//player.vimeo.com/video/15077261\""
//player.vimeo.com/video/15077261
<iframe src="//player.vimeo.com/video/15077261" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
echo '<h2>You posted:</h2><hr/>'.$_POST['title'].'<hr/>'.str_replace('\"','',$_POST['myTextArea']);