をフィールド。2入力を検索すると、これは検索フィールドがである私のインデックスページでPHPのMySQL
のindex.php
<form method="post" action="search.php?go" id="searchform">
<input type="text" name="Date">
<input type="submit" name="submit1" value="Search">
</form>
これは私のsearch.phpページです
<?php
/* showing table after searching for date */
if(isset($_POST['submit'])){
if(isset($_GET['go'])){
$Date=$_POST['Date'];
$query= mysql_query("SELECT ID,Name,Location,Date,Category,LabourSupplier,InTime,OutTime,Day,DayRate,Salary,OTHours,OTrate,OTAmount,Allowance2,TotalSalary,Advance,SalaryToHand FROM attendance WHERE Date LIKE '%" . $Date . "%' ORDER BY location DESC, LabourSupplier ASC",$connection)
or die("Failed to query database" .mysql_error());
while($row=mysql_fetch_array($query)){
print "<tr>";
print "<td >" . $row['ID'] . "</td>";
print "<td >" . $row['Name'] . "</td>";
print "<td >" . $row['Location'] . "</td>";
print "<th >" . $row['Date'] . "</th>";
print "<td >" . $row['Category'] . "</td>";
print "<td >" . $row['LabourSupplier'] . "</td>";
print "<th >" . $row['InTime'] . "</th>";
print "<th >" . $row['OutTime'] . "</th>";
print "<th >" . $row['Day'] . "</th>";
print "<th >" . $row['DayRate'] . "</th>";
print "<th >" . $row['Salary'] . "</th>";
print "<th >" . $row['OTHours'] . "</th>";
print "<th >" . $row['OTrate'] . "</th>";
print "<th >" . $row['OTAmount'] . "</th>";
print "<th >" . $row['Allowance2'] . "</th>";
print "<th >" . $row['TotalSalary'] . "</th>";
print "<th >" . $row['Advance'] . "</th>";
print "<th>" . $row['SalaryToHand'] . "</th>";
print "</tr>";
}
}
}
print "</table>";
?>
私は別の検索フィールドを追加して、1つの検索ボタンで日付と場所の両方を検索し、両方の場所の広告日が満たされた結果を取得したいと考えています。
単に別の入力テキストフィールドを追加し、それを使用しsubmit1するポストの名前を変更しますポスト変数。 – RJParikh