im trying to get the values of the text field displayed even after inserting the data into the database but im not doing it right because this error "<br /><b>Notice</b>: Undefined index: basic in <b>C:\xampp\htdocs\CashFlow\income.php</b> on line <b>77</b><br />" is shown inside the text field instead. There was one thread that had what i needed which is to display the value in the text field but i got this error. So if anyone could help me thanks :)
this is my code
<?php
session_start();
if(isset($_POST['save']))
{
$basic = $_POST['basic'];
$allowance = $_POST['allowance'];
$_SESSION ['basic']=$basic;
$_SESSION ['allowance']=$allowance;
if($basic&&$allowance)
{
require ("connect.php");
$query=("INSERT INTO income VALUES ('$basic', '$allowance')");
$result=mysql_query($query);
if($result)
{
echo ('<script type="text/javascript">alert("Saved in database")</script>');
}
else
{
echo('<script type="text/javascript">alert("Could not be saved")</script>');
}
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;" charset="iso-8859-1;">
<link rel="stylesheet" type="text/css" href="css/style.css" media="screen">
<script type="text/javascript" src="javascript/date.js"></script>
</head>
<body onload="add">
<center><img class="banner" src="image/banner.jpg"></center>
<div class="button">
<div class="bcontent">
<ul class="menu">
<li class="nvg"><a class="nav" href="">Help</a></li>
<li class="nvg"><a class="nav" href="">About</a></li>
</ul>
</div>
</div>
<center><h1><a href="profile.php">(name)</a> Income</h1></center>
<center><div id="content">
<center><span id="date_time"></span>
<script type="text/javascript">window.onload = date_time('date_time');</script></center>
<form method="post" action="income.php" name="netsalary" style="float:left; margin-left:15px; margin-top:15px;">
<div style="background-color:black; width:450px; height: 100px;"><table border="1" rules="groups" cellpadding="6px" width="450px" style="background-color:AntiqueWhite; margin-top: 30px;">
<thead>
<tr>
<th>FIXED MONTHLY SALARY</th>
<th></th>
<th>RM</th>
</tr>
</thead>
<tr>
<td><center>Basic Salary</center></td>
<td></td>
<td><center><input type="text" name="basic" value="<?php echo $_SESSION ['basic']; ?>" size="11"></center></td>
</tr>
<tr>
<td><center>Fixed monthly allowance</center></td>
<td></td>
<td><center><input type="text" name="allowance" value="<?php echo $_SESSION ['allowance']; ?>" size="11"></center></td>
</tr>
</table>
</div>
<input type="submit" value="Save" class="save" name="save">
</form></div>
<div id="calculate">
<input type="submit" class="calctotal" value="Generate Total" name="total">
</div>
</div></center>
</body>
</html>
<?php
exit();
?>