私はこのようなフォームを持っています:
<form method="post" action="track_reports.php" name="form">
<table id="mytable">
<tr>
<td>
<input type="checkbox" name="chkBadge" onClick="apply(this.checked, 'textBox')"> <font class="category">Badge ID</font>
</td>
<td>
<input id="textBox" class="text sign" type="text" name="badge_id" disabled="disabled">
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="chkEmp" onClick="apply(this.checked, 'textBox2')"> <font class="category">Employee Name</font>
</td>
<td>
<input id="textBox2" class="text sign" type="text" name="employee_name" disabled="disabled">
</td>
</tr>
<tr>
<td>
<input id="myCheckBox" type="checkbox" name="chkEmpOtDate" onClick="apply(this.checked, 'textBox3', 'textBox4')"> <font class="category">OT Date</font>
</td>
<td>
<font class="category">From</font> <input class="text sign" id="textBox3" type="text" name="alamat" disabled="disabled"> <font class="category">To</font> <input class="text sign" id="textBox4" type="text" name="alamat" disabled="disabled">
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="submit" value="Submit" disabled>
</td>
</tr>
</table>
</form>
これは追跡レポートのソースです:
<div id="bodyText" class="bodyText">
<div class="header">
<div class="content">
<h1>Report Submissions</h1>
</div>
</div>
<?php
include ("config.php");
$bagianWhere = "";
if (isset($_POST['chkBadge']))
{
$badge_id = $_POST['badge_id'];
if (empty($bagianWhere))
{
$bagianWhere .= "badge_id = '$badge_id'";
}
}
if (isset($_POST['chkEmp']))
{
$employee_name = $_POST['employee_name'];
if (empty($bagianWhere))
{
$bagianWhere .= "employee_name LIKE '$employee_name'";
}
else
{
$bagianWhere .= " AND employee_name LIKE '$employee_name'";
}
}
if (isset($_POST['chkOtdate']))
{
$ot_date = $_POST['ot_date'];
if (empty($bagianWhere))
{
$bagianWhere .= "ot_date LIKE '%$ot_date%'";
}
else
{
$bagianWhere .= " AND ot_date LIKE '%$ot_date%'";
}
}
$query = "SELECT * FROM t_submissions WHERE ".$bagianWhere;
$hasil = mysql_query($query);
echo "<table cellspacing='0'>";
echo "<tr><th class='th'>Badge ID</th><th class='th'>Employee Name</th><th class='th'>Department</th><th class='th'>OT Date</th></tr>";
while ($data = mysql_fetch_array($hasil))
{
echo "<tr><td class='td'>".$data['badge_id']."</td><td class='td'>".$data['employee_name']."</td><td class='td'>".$data['dept_name']."</td><td class='td'>".$data['ot_date']."</td></tr>";
}
echo "</table>";
?>
<br>
<a title="Export to PDF"><img src="images/pdf_files.png"></a>
<a title="Export to Excel"><img src="images/excel_file.png"></a>
<br><br>
<input type="button" VALUE="Back" onClick="history.go(-1);return true;">
</div>
BadgeID を使用して検索しようとすると、データが表示されます。ページに表示されているデータを PDF/Excel にエクスポートする方法を教えてください。