0

我有一个带有 2 个按钮的表单。我希望它根据复选框选择结果中的发布操作将我的结果重定向到名为 data_results 的页面上。当我单击导出时,它使用该操作。我的问题是它没有重定向或取值。

<form name="search" action="" method="POST" enctype="multipart/form-data">
<input name="txtsearch" type="text" />
<select name="searchby" size="1">
<option>Search by</option>
<option value="rule">Rule Number</option>
<option value="pattern_num">Pattern Number</option>
</select>
<input type="submit" name="btnsearch" value="Search" />&nbsp;&nbsp;<input type="submit" name="btnexport" value="Export" /
<P></P>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="60"><span class="content"><strong>ID</strong></span></td>
    <td width="120" align="center"><strong><span class="content">STAMP</span></strong></td>
    <td width="83" align="center"><span class="content"><strong>RULE</strong></span></td>
    <td width="139"><span class="content"><strong>TEST</strong> <strong>STRING</strong></span></td>
    <td width="90" style="overflow:auto"><span class="content"><strong>TEST</strong> <strong>RESULT</strong></span></td>
    <td width="100%"><span class="content"><strong>TYPE</strong></span></td>
  </tr>
<?php global $database;
$sql="SELECT * FROM tbl ORDER BY id DESC";
    $result_set = $database->query($sql);
    while ($row=$database->fetch_array($result_set)){
 ?>
<tr><td>&nbsp;</td></tr>
<tr>
 <td width="60" valign="top"><span class="content"><?php echo $row['id']; ?></span></td>
    <td valign="top" width="120" align="right"><span class="content"><?php echo $row['stamp']; ?></span></td>
    <td valign="top" width="139" style="overflow:auto;"><span class="content"><?php echo $row['test_string']; ?></span></td>
    <td valign="top" width="90"><span class="content"><?php echo $row['test_result']; ?></span></td>
    <td valign="top" width="100%"><span class="content"><?php echo $row['type']; ?></span></td>
     <td valign="top" width="50"><span class="content"><input name="check_list[]" type="checkbox" id="check_list[]" value="<?php echo $row['id']; ?>" /></span></td>
  </tr><?php }  ?></form>

</table>
<?php
if(!empty($_POST['check_list'])) {
    foreach($_POST['check_list'] as $check) {
     $sql="SELECT * FROM tblrules WHERE id={$check}";
    $result_set = $database->query($sql);
    while ($row=$database->fetch_array($result_set)){
        echo "filter {"."<br>";
        echo "\t\t\t\t"."test {"."<br>";
        echo "\t\t\t\t"."type=>".$row['type']."<br>";
        echo "\t\t\t\t"."add_tag => sort_order"."<br>";
            echo "\t"."}"."<br>";
        echo "\t"."}"."<br>";
        }

    }
}
?>
4

1 回答 1

0

要提交重定向到 YourScriptDir/data_results.php,请修改导出按钮代码,如下所示:

<input type="submit" 
       name="btnexport" 
       onclick="document.location='http://YourScriptDir/data_results.php';"
       value="Export" />

如果启用了用户浏览器 javascript,这将起作用,这是当今的一般情况。

希望这可以帮助...

于 2013-02-27T09:52:21.880 回答