Refresh page without button

Sir I have these codes

[php]<?php
session_start();
if(!isset($_SESSION[‘user’]))
{
header(“location: admin/login.php”);
}
include_once(“includes/connectsql.php”);

$date1=date(‘Y-m-d’);
$t_date1=isset($_POST[‘t_date1’])?$_POST[‘t_date1’]:$date1;
$t_date1=date(‘Y-m-d’,strtotime($t_date1));

//-----------------------------------------------------
// find
if(isset($_POST[‘btn_find’]))
{

$acc_code1=‘2310001’;
$mybalance=0;
$mydrcr=’’;

$query = “select vou_no,acc_code,acc_name,dr_amount,cr_amount,qty,circle
from crsalp where date=’”.$t_date1."’ and (SUBSTRING(acc_code,1,2)=‘32’ or SUBSTRING(acc_code,1,2)=‘33’)
order by vou_no,acc_code";
}

?>

Sales Journal .container{ margin:0 auto; width:40%; border:1px solid gray; padding-top:40px; margin-top:40px; }
Date
<?php $query = "select vou_no,acc_code,acc_name,dr_amount,cr_amount,qty,circle from crsalp where date='".$t_date1."' and (SUBSTRING(acc_code,1,2)='32' or SUBSTRING(acc_code,1,2)='33') and qty>0 order by vou_no,acc_code";
           $result = sqlsrv_query($con,$query) or die ("Error". sqlsrv_errors($con)) ;   
           $row_count = sqlsrv_num_rows($result); 
               
           while($res = sqlsrv_fetch_array($result)) { 
           echo "<tr>"; 
              echo "<td align='center'>".($res['vou_no'])."</td>";     
           echo "<td align='center'>".substr($res['acc_code'],0,4)."-".substr($res['acc_code'],4,7)."</td>"; 
                   $partycode=($res['acc_code']); 
           echo "<td align='center'>".($res['qty'] != 0 ? number_format($res['qty']):'')."</td>"; 
           echo "<td style='color:red;' align='right'>".($res['cr_amount'] != 0 ? number_format($res['cr_amount']):'')."</td>";     
           echo "</tr>"; 
           } 
               ?> 
     </table> 
  </form> 
[/php]

When I run form then codes work fine, no error, showing proper data like shown in attachment

When I select a NEW data then every time I have to press FIND button for page refresh.

Is it possible to get rid of submit button?
I mean when I select new date then data must appear in table.

Please help


Untitled.png

Vou. # Code Qty. Amount

You could have it trigger a number of ways. If you were doing this in an API fashion, I would have the data update trigger using onchange.

Sponsor our Newsletter | Privacy Policy | Terms of Service