So im not too sure if im posting this in the right forum. please dont be angry! new at daniweb
so basically what i wanna know is how to save real time date into database.
what i have is a page with tabs of month and in each tab the content consists of a form and in the form theres a table and save button and also coding to display real time(year)
tab (month feb)
<div class="tabContent" id="feb">
<center><h2>February <span id="year"><script type="text/javascript">document.write(new Date().getFullYear())</script></span></h2></center> <---real time(year)
<div>
<form method="post" action="income.php">
<div style="height:0px;">
<div class="rmtotal">
<?php if(@$febresult) ?>
<h3>Your Total Income :</br> <?php echo "RM ".@$febtotal?></h3>
</div>
<input type="submit" value="Save" class="save" name="febsave">
</div>
<table border="1" rules="groups" cellpadding="10px;" class="tableincome">
<thead>
<th>Monthly Salary</th>
<th></th>
<th>RM</th>
</thead>
<tr>
<td>Royalty</td>
<td></td>
<td><center><input type="text" placeholder="0" name="febroyalty" size="11" value="<?php if(isset($_POST['febroyalty'])){echo htmlentities($_POST['febroyalty']);} ?>"></center></td>
</tr>
<tr>
<td>Subletting/Rent</td>
<td></td>
<td><center><input type="text" placeholder="0" name="febsub" size="11" value="<?php if(isset($_POST['febsub'])){echo htmlentities($_POST['febsub']);} ?>"></center></td>
</tr>
<tr>
<td>Others(Unit Trust/Emas/IPO/etc)</td>
<td></td>
<td><center><input type="text" placeholder="0" name="febothers" size="11" value="<?php if(isset($_POST['febothers'])){echo htmlentities($_POST['febothers']);} ?>"></center></td>
</tr>
</table>
</form>
</div>
</div>
i was thinking that after the user has clicked on save button it will save all user input along with the real-time(year) into a table in the database. right now my php coding only saves the text box values:
if(isset($_POST['febsave']))
{
$febroyalty = $_POST['febroyalty'];
$febsub = $_POST['febsub'];
$febothers = $_POST['febothers'];
if($febroyalty&&$febsub&&$febothers)
{
require "connect.php";
$febtotal=($febroyalty + $febsub + $febothers);
$query=("INSERT INTO feb VALUES ('$febroyalty','$febsub','$febothers','$febtotal')");
$febresult=mysql_query($query);
}
else
{
echo ("<b>Please fill out the entire form.</b>");
}
}
but i also wanna be able to save the year into the database. is that possible? or is there a diff way of doing the whole real time date thing? or any improvement in my coding in general. noob