So as the title entails, my if else statemnt in php won't execute. i mean i would undrstand if the 'if' didn't execute but it didn't even read the else statement. so when i submit nothing happens.
<?php
session_start();
if(isset($_POST['jansave']))
{
$basic = $_POST['basic'];
$allowance = $_POST['allowance'];
$bonus = $_POST['bonus'];
$epf = $_POST['epf'];
$asb = $_POST['asb'];
$royalty = $_POST['royalty'];
$sub = $_POST['sub'];
$div = $_POST['div'];
$others = $_POST['others'];
if($basic&&$allowance&&$bonus&&$epf&&$asb&&$royalty&&$sub&&$div&&$others)
{
require "connect.php";
$total=($basic + $allowance + $bonus + $epf + $asb + $royalty + $sub + $div + $others);
$query=("INSERT INTO january VALUES ('$basic', '$allowance', '$bonus', '$epf', '$asb', '$royalty', '$sub', '$div', '$others', '$total')");
$result=mysql_query($query);
if($result)
{
echo "<b>Your Total Income is $total</b>";
}
}
else
{
echo ('<script type="text/javascript">alert("Sorry!");</script>');
}
}
?>
html code:
<form method="post" action="income.php">
<div style="height:0px;"><input type="submit" value="Save" class="save" name="jansave"></div>
<table border="1" rules="groups" cellpadding="10px;" class="tableincome">
<thead>
<th>Monthly Salary</th>
<th></th>
<th>RM</th>
</thead>
<tr>
<td>Basic Salary</td>
<td></td>
<td><center><input type="text" name="basic" size="11" placeholder="0" value="<?php if(isset($_POST['basic'])){echo htmlentities($_POST['basic']);} ?>"></center></td>
</tr>
<tr>
<td>Fixed Allowance</td>
<td></td>
<td><center><input type="text" name="allowance" size="11" placeholder="0" value="<?php if(isset($_POST['allowance'])){echo htmlentities($_POST['allowance']);} ?>"></center></td>
</tr>
<tr>
<td>Bonus</td>
<td></td>
<td><center><input type="text" name="bonus" size="11" placeholder="0" value="<?php if(isset($_POST['bonus'])){echo htmlentities($_POST['bonus']);} ?>"></center></td>
</tr>
<thead>
<th>OTHER SOURCE OF INCOME</th>
<th></th>
<th>RM</th>
</thead>
<tr>
<td>EPF</td>
<td></td>
<td><center><input type="text" name="epf" size="11" placeholder="0" value="<?php if(isset($_POST['epf'])){echo htmlentities($_POST['epf']);} ?>"></center></td>
</tr>
<tr>
<td>ASB</td>
<td></td>
<td><center><input type="text" name="asb" size="11" placeholder="0" value="<?php if(isset($_POST['asb'])){echo htmlentities($_POST['asb']);} ?>"></center></td>
</tr>
<tr>
<td>Dividen/Interest(AHB/TABUNG HAJI/etc)</td>
<td></td>
<td><center><input type="text" name="div" size="11" placeholder="0" value="<?php if(isset($_POST['div'])){echo htmlentities($_POST['div']);} ?>"></center></td>
</tr>
<tr>
<td>Royalty</td>
<td></td>
<td><center><input type="text" name="royalty" size="11" placeholder="0" value="<?php if(isset($_POST['royalty'])){echo htmlentities($_POST['royalty']);} ?>"></center></td>
</tr>
<tr>
<td>Subletting/Rent</td>
<td></td>
<td><center><input type="text" name="sub" size="11" placeholder="0" value="<?php if(isset($_POST['sub'])){echo htmlentities($_POST['sub']);} ?>"></center></td>
</tr>
<tr>
<td>Others(Unit Trust/Emas/IPO/etc)</td>
<td></td>
<td><center><input type="text" name="others" size="11" placeholder="0" value="<?php if(isset($_POST['others'])){echo htmlentities($_POST['others']);} ?>"></center></td>
</tr>
</table>
</form>
could someone please point out my utterly stupid mistake that i did? coz the php code was fine yesterday then i had to redo some coding and today it aint working.