如何通过post方法将文本区域内容发送到下一页


How to send text area content to next page via post method?

我有一个文本区域,里面有一些html代码。我想通过post方法将这个文本区域的内容发送到下一页,而不做任何更改。

<html>
<form id="myform" name="myform" action="./getdata.php" method="post">
<td><textarea rows="7" cols="15" name="outputtext" style="width: 99%;"></textarea></td>
<input type="submit">
</form>
</html>

和我的php代码:

<?
$file_contents = $_POST['outputtext'];
?>
<textarea rows="30" cols="150"><?PHP  print_r($file_contents); ?></textarea>

我的代码的问题是,当它发送到下一页时,我的第一个文本区域的原始内容会发生更改!例如:

<a href="/season/episodes.php?name=ok&id=1">

变为:

<a href='"/season/episodes.php?name=ok&id=1'">

你们能告诉我如何在不更改下一页的情况下保留原始html内容吗?(请注意,我在第二页中的所有html内容都发生了变化,我不想更改)。第二页的第二个文本区域是为了测试目的,我实际上想解析$file_contents的原始值,但由于某种原因,它发生了变化!

在您的第二个PHP脚本中,只需使用strip_splash删除传递的文本中多余的斜杠:

<?
$file_contents = stripslashes($_POST['outputtext']);
?>
<textarea rows="30" cols="150"><?PHP  print_r($file_contents); ?></textarea>