As you know, in Joomla, to take the value of all fields of a certain form, they must have the names like name="jform[something]" and then we can take them with the help of the code:

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

But is it possible to take the value of all fields if their names have the usual form name="something" without jform[] and the form itself has its <form name="myForm"> for example <form name="myForm"> ? If so, how?

    1 answer 1

    Already found the answer:

     // берём все поля формы $jinput = JFactory::getApplication()->input; $formData = new JRegistry($jinput->post->getArray()); // и получаем результат как {"someName1":"someValue1","someName2":"","someName3":"someValue3"} // оставляем лишь заполненные поля и убираем value кнопки submit $json = json_decode($formData); $arrayOfFields = array(); foreach($json as $name => $value) { if(!empty($value) && $name !== 'submit') { $arrayOfFields[] = $name.': '.$value; } } echo implode(', ',$arrayOfFields); // получим someName1: someValue1, someName3: someValue3