0

As we know we can retrieve values of all the fields if they have names like name="jform[something]" and we can use the code:

$jinput = JFactory::getApplication()->input;
$formData = new JRegistry($jinput->get('jform', '', 'array'));

But is there some way to do the same if we have form with some name for example <form name="myForm"> and fields with names like name="something" i.e. without jform[] ?

Thanks in advance

Joomla 3.5.1

stckvrw
  • 1,689
  • 18
  • 42

1 Answers1

1

This is the correct way to retrieve post data array, you don't need to use JRegistry:

$jinput = JFactory::getApplication()->input;
$data = $jinput->post->get('jform', array(), 'array');

If you just need one parameter use the same function like this:

$something = $jinput->post->get("something");

*second and third parameters are default_value in case of no value found and filter (string, integer, ...).

Check this page for details. I would also suggest you to ask Joomla related questions on joomla.stackexchange.com to get better answers.

Community
  • 1
  • 1
Kitase88
  • 186
  • 4
  • 14