提交按钮不会出现

Submit Button won't appear

更新:到目前为止,这是我的代码。现在出现了下载按钮,但代码打印的是表单结束标记,而不是将其标识为结束标记。我该如何纠正这个问题?请帮忙。提前致谢!!

<HTML>
<HEAD>
    <meta charset="utf-8">
    <link rel="stylesheet" href="css/style2.css">
    <TITLE>SAE Report</TITLE>
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
   $().ready(function() {
     $(".datepicker").datepicker({dateFormat:'yy-mm-dd'});
   });
</script>

</HEAD>
<BODY>
<center>
<h1>SAE Report</h1>
</center>
 <form action = "" method = "post">
 <label>Report Type</label>
    <select id="report" name="report">
        <option value="none"></option>
        <option value="new">New SAEs Report</option>
        <option value="cumulative">Cumulative SAE Report</option>
    </select>
 <label>Start Date</label><input type="text" class="datepicker" name="start">
 <label>End Date</label><input type="text" class="datepicker" name="end">
 <input type="submit" name="submit" value="Submit">
 </form>
</BODY>

 <?php
 $type='';
 $start='';
 $end='';

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

    $type=$_POST['report'];
    $start=$_POST['start'];
    $end=$_POST['end'];

    if ($type=="cumulative"){
        echo "<form action='cumulativeRptExcel.php' method='post' name ='xls'>";
        echo "<input type='submit' name='submitXLS' value='Download Excel'/>";
        echo "/form><br>";
        echo "<form action='cumulativeRptPDF.php' method='post' name ='xls'>";
        echo "<input type='submit' name='submitXLS' value='Download PDF'/>";
        echo "/form><br>";
    }
    elseif($type=='new' and $start!='' and $end!=''){
        echo "<form action='newRptExcel.php' method='post' name ='xls'>";
        echo "<input type='submit' name='submitXLS' value='Download Excel'/>";
        echo "/form><br>";
        echo "<form action='newRptPDF.php' method='post' name ='xls'>";
        echo "<input type='submit' name='submitXLS' value='Download PDF'/>";
        echo "/form><br>";
    }
    elseif($type="new" and ($start=='' or $end=='')){
        echo "You need to select START and END date for the report";
    }   

}


?>

report.php 文件包含生成 excel 或 pdf 文件并使其可供用户下载的代码。当 运行 这些文件自己生成文件时,它会很好地生成文件。

更改您的提交按钮:

 <input type="submit" value="Submit">

 <input type="submit" name="submit" value="Submit">

这背后的原因是 $_POST 变量将仅包含在先前表单中具有名称的元素。在您的示例中,提交按钮没有名称。

它打印 /form> 因为根据您的代码,这就是您要求它打印的内容。你在我能看到的每一行中都回显了 "/form><br>"; 而不是 "</form><br>"; 。只需添加 < 即可修复