11-22-2018, 09:43 AM
Hi,
I'm trying to use the update function with the forms with the following code. I get the data in the form fine but when I go to save it I get a new row in the table and the original remains the same. Any ideas what I have done wrong?
I'm trying to use the update function with the forms with the following code. I get the data in the form fine but when I go to save it I get a new row in the table and the original remains the same. Any ideas what I have done wrong?
Code:
<?php
require_once 'init.php';
require_once $abs_us_root.$us_url_root.'users/includes/header.php';
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
if(!empty($_POST)){
$response = preProcessForm();
if($response['form_valid'] == true){
//do something here after the form has been validated
$response['fields']['user_id']=$user->data()->id;
$response = postProcessForm($response);
}
}
?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<?php
?>
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<?php
$usFormUpdate = 6; //The row you want to update
$options['update'] = $usFormUpdate;
//then call your form with
displayform('session',['update'=>6]);
?><p></p>
</div> <!-- /.col -->
</div> <!-- /.row -->
</div> <!-- /.container -->
</div> <!-- /.wrapper -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>