XF 2.0 how to show the value of form in controller and how to save it in database

hemant_bhardwaj

Well-known member
well i am working on addon but i am not able to view the submit data

controller :
1534271177763.webp


at actionindex() i am displaying a form with some input

1534271222729.webp


and when i try to hit save . i get Nothing
i am trying to get value from
$params i saw it in some code of xenforo not sure what is it.
 
You should get your capitalization straight, otherwise you'll run into tons of issues once you deploy to a case sensitive system. Other than that, post data from a form is available through the filter method, not the parameter bag, so in order to access server_title, you want to call the following code in the receiving controller method.
Code:
$this->filter('server_title', 'str');
The format is filter(variableName, variableType);. While 'str' (for string) is a wonderful wildcard for lazy people, for securities sake it's recommended to use the correct variable type. In your example that's string for the textboxrow.

When accessing an editor row, you'll have to go an entirely different way. Various examples can be found throughout the existing XF controllers, for example in the addReply action in the thread controller and the addThread action in the forum controller.
 
Back
Top Bottom