The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic Form Generation
#3
Yeah. There are a few auto generation features. The best ones are the ones that are designed to update the database (deal with $_POST), unless you want to have all fields be text. I'm probably not explaining that very well.

So let's say you have a table called "assets" with 20 columns in it. You would do something like this...

To EDIT a particular row of the assets table...
Code:
$t = 'assets';
Code:
$skip = ['id'];
Code:
generateForm($t,$id,$skip);
Then to process the form
Code:
$id = Input::get('id');
//make sure you are passing the id in the form itself
//do any checks you want to do here
Code:
$skipFields = ['create_type'];
Code:
$updateFields = updateFields2($_POST, $skipFields);
Code:
$db->insert('assets',$updateFields);
Code:
$db->update('assets',$id,$updateFields);

to ADD a row to that table...
Code:
$t = 'assets';
Code:
$skip = ['id'];
Code:
generateAddForm($t,$skip);

Then to process the form
//do any checks you want to do here
Code:
$skipFields = ['create_type'];
Code:
$updateFields = updateFields2($_POST, $skipFields);
Code:
$db->insert('assets',$updateFields);
  Reply


Messages In This Thread
Dynamic Form Generation - by shoropio - 09-03-2017, 03:47 AM
Dynamic Form Generation - by Brandin - 09-03-2017, 11:20 AM
Dynamic Form Generation - by mudmin - 09-03-2017, 12:45 PM
Dynamic Form Generation - by shoropio - 09-03-2017, 02:20 PM
Dynamic Form Generation - by mudmin - 09-03-2017, 02:30 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)