The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
Getting Data From database - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: Getting Data From database (/showthread.php?tid=1578) |
Getting Data From database - DrkNT - Aug 31st, 2011 Hi, I'm trying to get the forms data from the database and show it in a custom page which is similar to Edit submission page that is already available in FormTools. I manage to figure out how to pass the client info to my page using the codes below which i found from other threads. PHP Code: $account_info = ft_get_account_info($_SESSION["ft"]["account"]["account_id"]); But, I cannot figure out how to pull the data from the database and insert each value into the fields like you did in edit submission. I tried using ft_api_show_submissions api, but it just shows all the data I had in the database. I have also seen the registration demo's code. However I think this method only works in multi-page form? Is there a function or variable that I can use like $_SESSION? Basically, what I'm trying to do is to make a custom edit submission page that also have the client's info stored in the database. RE: Getting Data From database - Ben - Sep 4th, 2011 Hi DrkNT, Interesting! Hmm... to be honest it isn't really something I can just explain in a few lines. There's a great deal going on in the Form Tools edit submission page with displaying and editing the content. But maybe check out the Submission Accounts module. That has it's own Edit Submission page that's a little less complicated than the one in the Core (but still pretty complicated, sorry!). Hopefully it will be a little easier to make sense of the code of how it's all fitting together. Sorry, I wish I could be more help but this is very much a hands-on thing that requires a lot of digging through code. - Ben RE: Getting Data From database - DrkNT - Sep 4th, 2011 Hi Ben, I understand that after all the checks that edit_submission.tpl does, it will display the data using smarty code: Code: {edit_custom_field form_id=$form_id submission_id=$submission_id field_info=$curr_field field_types=$field_types settings=$settings} {$settings} However I cannot figure out how it is showing the data. From what I understand of how FormTools works is that it needs the form_id and submission_id to know which table from the database to open. I just need to know how to get it out of the array. Thank you. Edit: Nvm, I Figured it out. I can use the code below to get the data I need. Code: $Data = ft_get_submission($_GET[form_id],$_GET[submission_id]); I Just hope that the Edit portion will be correct RE: Getting Data From database - DrkNT - Sep 11th, 2011 Hi Ben, I Manage to link the data to my page and I found the codes needed to submit the updated form. Code: $editable_field_ids = _ft_get_editable_view_fields($view_id); The return I get from $g_success is true and everything seems to be working properly. However the real data in the database is not updated. Did I miss something? What else is needed to update the data from the form? Also I tried to use Submission account module, but it did not show the editable fields after the user is logged in. Is this a bug? RE: Getting Data From database - aningbo - Sep 11th, 2011 Submission account module has been updated. it was a bug which has been fixed in the latest version. update it. RE: Getting Data From database - DrkNT - Sep 13th, 2011 (Sep 11th, 2011, 10:39 PM)aningbo Wrote: Submission account module has been updated. it was a bug which has been fixed in the latest version. update it. Thank you aningbo, it works now. Ok, after much testing I realise that the $editable_field_ids variable can get the field id list but it is not transferred and stored into $request["editable_field_ids"] somehow the data is lost once I click on submit. Any idea how to resolve this problem? |