Hi Any help appreciated.
When the page loads the first thing that happens is a query is run to see if the last time sheet was completed correctly ie each time field has a value.
If it is incomplete a session variable is set with the last entries date. The user can then make any adjustments or add extra times.
Now the issue I have is this. The incomplete time sheet is displayed in a form and I would like to have two options, if save is selected, then the page is submitted to itself and a query is run to update / insert the new values and the same page / form appears. The other option is the user fills in all the fields that are outstanding and instead of clicking on the save button clicks on a complete button. What I would like it to do is save the details and remove the session, but how can I tell it to do this?
Here is a basic version of what I have. Is it possible to have effectively have two submits buttons for the same form and use it with php?
Any help appreciated. Thank you.
<?php
if($_POST['submitted']){
//update query
}
?>
<form action="test.php" method="post">
Time 1<input type="text" name="time1" /><br /><br />
Time 2<input type="text" name="time2" /><br /><br />
Time 3<input type="text" name="time3" /><br /><br />
Time 4<input type="text" name="time4" /><br /><br />
Time 5<input type="text" name="time5" /><br /><br />
Time 6<input type="text" name="time6" /><br /><br />
<input type="hidden" name="submitted" value="true" />
<input type="image" src="/images/save.png" /><br /><br />
<input type="image" src="/images/complete.png" /><br /><br />
</form>
When the page loads the first thing that happens is a query is run to see if the last time sheet was completed correctly ie each time field has a value.
If it is incomplete a session variable is set with the last entries date. The user can then make any adjustments or add extra times.
Now the issue I have is this. The incomplete time sheet is displayed in a form and I would like to have two options, if save is selected, then the page is submitted to itself and a query is run to update / insert the new values and the same page / form appears. The other option is the user fills in all the fields that are outstanding and instead of clicking on the save button clicks on a complete button. What I would like it to do is save the details and remove the session, but how can I tell it to do this?
Here is a basic version of what I have. Is it possible to have effectively have two submits buttons for the same form and use it with php?
Any help appreciated. Thank you.
<?php
if($_POST['submitted']){
//update query
}
?>
<form action="test.php" method="post">
Time 1<input type="text" name="time1" /><br /><br />
Time 2<input type="text" name="time2" /><br /><br />
Time 3<input type="text" name="time3" /><br /><br />
Time 4<input type="text" name="time4" /><br /><br />
Time 5<input type="text" name="time5" /><br /><br />
Time 6<input type="text" name="time6" /><br /><br />
<input type="hidden" name="submitted" value="true" />
<input type="image" src="/images/save.png" /><br /><br />
<input type="image" src="/images/complete.png" /><br /><br />
</form>