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
generateAddForm
#3
Here's a more detailed answer. Generally when you're inserting, you don't want to let people set the id field, so you can tell generateAddForm to skip it by doing this. (I'm choosing MQTT because it's a table you're not going to break by inserting random data)

Code:
<?php generateAddForm('mqtt',['id']);?>

Then you can actually process the form somewhat automatically.

Code:
if(!empty($_POST)){
Code:
$fields = updateFields2($_POST);
//if you want to see what you have at this point...
//dnd($fields);
//do any checks you want to do here.
Code:
$db->insert('mqtt',$fields);
Code:
bold("<br>New row inserted!");
Code:
}

  Reply


Messages In This Thread
generateAddForm - by fly476 - 02-15-2018, 01:28 AM
generateAddForm - by mudmin - 02-15-2018, 12:35 PM
generateAddForm - by mudmin - 02-15-2018, 12:43 PM
generateAddForm - by matthewra - 02-18-2018, 07:22 PM
generateAddForm - by mudmin - 02-18-2018, 08:07 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)