I thought I would start a new thread to address just this one issue.
I have two forms (one to input info; one to confirm and submit) On the confirm form there is an "edit" button that sends the user back to the first form with all the data filled in (via a db query using the cf_id that I GET from the url) All good so far.
Now the user makes a change to the info and the submit button is labeled "Save". Here is where I need help.
How do I set the form to UPDATE the db table instead of INSERT-ing a new record?
Can I do this in the "On Submit" ??? If so, how?
Thanks,
Code on first form to tell if the form is being edited:
I have two forms (one to input info; one to confirm and submit) On the confirm form there is an "edit" button that sends the user back to the first form with all the data filled in (via a db query using the cf_id that I GET from the url) All good so far.
Now the user makes a change to the info and the submit button is labeled "Save". Here is where I need help.
How do I set the form to UPDATE the db table instead of INSERT-ing a new record?
Can I do this in the "On Submit" ??? If so, how?
Thanks,
Code on first form to tell if the form is being edited:
<?php $edit = true;
$cf_id = $_GET['cf_id'];
if($cf_id > 0){
global $mainframe;
$database =& JFactory::getDBO();
$database->setQuery( 'SELECT * FROM jos_chronoforms_giftcard_submit WHERE cf_id = '.$cf_id.'');
$database->query();
$rows = $database->loadAssocList();
?>
<!-- form in edit mode with data filled in
...
-->
<div>
<input type="submit" name="submit" value="Save" />
<input type="reset" value="Reset Form" />
</div>
<?php }else{ ?>
<!-- blank form
...
-->
<div>
<input type="submit" name="submit" value="Process" />
<input type="reset" value="Reset Form" />
</div>
<?php } ?>