My form has a 'save' button and 'select from previous month' button. what 'save' button does is insert all the values into my database.
save button code:
if(isset($_POST['jansave']))
{
$basic = $_POST['basic'];
$allowance = $_POST['allowance'];
if($basic&&$allowance)
{
require "connect.php";
$total=($basic + $allowance);
$query=("INSERT INTO january (basic,allowance) VALUES ('$basic','$allowance')");
$janresult=mysql_query($query);
}
else
{
echo ("<b>Please fill out the entire form.</b>");
}
}
and also when the user clicks on the save button the values that they have already inserted in the text boxes are still in the text box via the value attribute :
<input type="text" name="allowance" size="11" placeholder="0" value="<?php if(isset($_POST['allowance'])){echo htmlentities($_POST['allowance']);} ?>">
but now im trying to set up the 'select from previous month' button. and what i want it to do is retrieve data from the previous month and display the data inside the specific text box of the present month. for example i have a february form and when i click on the select from previous month the data from january database will be displayed in the february form according to specific text boxes. How do i achieve that?
i hope im explaining this right. :s if not tell me.