为什么目标="空白"没有打开一个新窗口

时间:2011-10-10 02:14:36

标签: window new-operator

我将在新窗口中显示$ Content。经过一些搜索后,我发现了以下代码。但它没有打开一个新窗口并在同一页面中回显$ content。

 <form method="POST" action=" <?php echo $Content; ?> " target="blank"></form>

更新: 这是代码:

    <?php

if(isset($_POST['submit'])) 
{

include 'library/config.php';
include 'library/opendb.php'; 
$Unit_Code    = $_POST['Unit_Code'];
$File_Name    = $_POST['File_Name'];
$_SESSION['Unit'] =$Unit_Code;
$_SESSION['file'] =$File_Name;
$query = "SELECT Unit_Code,File_Name, type,size, Content FROM Units WHERE ((Unit_Code = '$Unit_Code')&&(File_Name='$File_Name'))";
$result = mysql_query($query) or die(mysql_error());
list($Unit_Code, $File_Name, $type, $size,  $Content) = mysql_fetch_array($result);
header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: attachment; filename=$File_Name");
?>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="dblclick.js"></script>
</head>

<body>
<form method="POST" action=" <?php echo $Content; ?> " target="_blank"></form>

</body>
</html>

<?php 
include 'library/closedb.php'; 
exit;
}

?>

3 个答案:

答案 0 :(得分:2)

这是target="_blank"。下划线很重要。

答案 1 :(得分:1)

你错过了_

<form action="URL TO POST THE FORM" method="POST" target="_blank">
  <?php echo $Content; ?>
</form>

答案 2 :(得分:0)

在HTML属性中_之前遗漏:target< .. target="_blank">