所以,我有以下代码:
<input type="text" name="months">
<input class="button" type="submit" onclick="message()" value="Submit"/>
<?
$monthss=$_POST['months'];
echo $monthss;
$q = "Select to_char(tgl_val,'MM-YYYY') as tglmonth where bt_number=".$bt_number." and to_char(tgl_val,'MM-YYYY')=".$monthss." order by tglmonth asc";
$s2=OCIParse($c_slave,$q);
//OCIBindByName($s2,":bind1",$ordernumber);
OCIExecute($s2,OCI_DEFAULT);
echo "<tr><td>";
echo "MONTH";
echo "</td><td>";
echo "AMOUNT";
echo "</td><td>";
echo "DISCOUNT_AMOUNT";
echo "</td><td>";
echo "SERVICES";
echo "</td><td>";
echo "TAX";
echo "</td><td>";
echo "TOTAL_AMOUNT";
echo "</td><td>";
echo "PRINT";
echo "</td></tr>";
while (OCIFetch($s2))
{
$V_TGLMONTH = oci_result($s2,'TGLMONTH');
$V_AMOUNT = oci_result($s2,'AMOUNT');
$V_DISCOUNT_AMOUNT = oci_result($s2,'DISCOUNT_AMOUNT');
$V_SERVICES = oci_result($s2,'SERVICES');
$V_TAX = oci_result($s2,'TAX');
$V_TOTAL_AMOUNT = oci_result($s2,'TOTAL_AMOUNT');
echo "<tr><td>";
echo "<a href=\"tgl.php?tmt=".substr($V_TGLMONTH,0,2)."&tmm=".substr($V_TGLMONTH,3,4)."\">";
echo $V_TGLMONTH;
echo "</a>";
echo "</td><td>";
echo $V_AMOUNT;
echo "</td><td>";
echo $V_DISCOUNT_AMOUNT;
echo "</td><td>";
echo $V_SERVICES;
echo "</td><td>";
echo $V_TAX;
echo "</td><td>";
echo $V_TOTAL_AMOUNT;
echo "</td><td>";
echo "PRINT";
echo "</td></tr>";
}
?>
重点是我有文本字段和按钮。在我用 mm-yyyy 填充texfield并单击按钮后,结果应该显示那个月的所有记录。但是当我用 01-2014 填充文本字段并单击按钮时,就会发生。你能帮帮我吗?
答案 0 :(得分:1)
<强>解决强>
这是我的最终HTML代码:
<form name="myForm" action="#" onsubmit="return validateForm()" method="post">
<input type="text" name="months" placeholder="mm-yyyy">
<input class="button" type="submit" value="Submit"/>
它是PHP代码:
<?
$months=$_POST['months'];
echo "<br><strong>Selected Month: </strong>" .$months;
echo "<br><br>";
$q = "Select AMOUNT, SERVICES, BILL_NO, ORDER_NUMBER, TOTAL_AMOUNT, to_char(PAY_DATE,'YYYY-MM-DD HH:MI:SS') as PAY_DATE from payment_final where bt_number=".$bt_number." and to_char(tgl_val,'MM-YYYY')='".$months."' order by bill_no";
?>