我有两个按钮(保存和显示),所以当我点击显示时,它必须在文本框中显示数据,保存它应该将数据保存到数据库中
<?php echo '<form method="post" enctype="multipart/form-data" name="form"
action="index.php?action=Add Post" class="standard">';
if (!isset( $_POST['calculate'])) {$TheStringpg =" SELECT sum(income_amount)from income where (income_date Between '". $_POST['start_date']."' and '". $_POST['end_date'] ."') and traditionalcouncil_name='".$Trad."' AND financialyear_id = '". $Finyear ."' "; $TheResultpg = pg_query($SYSconnMADE, $TheStringpg); while($arrpg = pg_fetch_array($TheResultpg)){ $income_balance = $arr['0'] ;
}
$TheString4 = " SELECT sum(expenditure_amount)from expenditure where (expenditure_date Between '". $_POST['start_date']."'
and '". $_POST['end_date'] ."') and traditionalcouncil_name='".$Trad."' AND financialyear_id = '". $Finyear ."' ";$TheResultp = pg_query($SYSconnMADE, $TheString4);
while($arr1 = pg_fetch_array($TheResultp)) {
$expenditure_balance = $arr['0'] ;
} }
echo '</select>
<input type="submit" name="calculate" alt="display" value="display">'; `
?>
答案 0 :(得分:0)
<div class="footer ban norep">
<div class="foot4 f4-pos im3 norep"></div>
</div>
<input type="submit" alt="display" value="display" name="display">';
答案 1 :(得分:0)
HTML代码:
<input type="submit" name="save" value="Save" />
<input type="submit" name="display" value="Display" />
PHP代码:
if(isset($_POST['save'])){
// Your query
} else if (isset($_POST['display'])){
// Your query
}