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
/printthread.php 16 require_once



UserSpice
how to add variables to database with your form manager or php file? - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: how to add variables to database with your form manager or php file? (/showthread.php?tid=1087)



how to add variables to database with your form manager or php file? - yourfriendkarol - 07-01-2018

I wanted to add user_ID next to the input he submits with a form created by your form manager

so I know which user entered that input and i can show him things accordingly.



I tried this
Code:
if(!empty($_POST)){
$response = preProcessForm();
$response['fields']['user_id']=$user->data()->id;
if($response['form_valid'] == true){
//do something here after the form has been validated
$response = postProcessForm($response)
}
}
from here:

https://userspice.com/advanced-form-processing/

[font=Monaco, Consolas, Courier, monospace]But i am getting errors.[/font]

[font=Monaco, Consolas, Courier, monospace]Also tried this:[/font]

PHP Code:
$my_user_id $user->data()->id;
if(!empty(
$_POST)){
processForm();
$db->insert("tablemain", ["userid"=>$columnmy_user_id]);
//do something here after the form has been validated} 

[font=Monaco, Consolas, Courier, monospace]but this only inserts, and I wanted to modify the added row to add user id to it. The update feature from documentation needs me to specify row but I cant know what row is that.[/font]


[font=Monaco, Consolas, Courier, monospace]How can one achieve adding user id variable to the row that user submitted to database? Thanks!
[/font]




<h1> nvm solved!</h1>