joomla获取帖子数据 [英] joomla get post data
问题描述
我正在创建joomla组件,并且无法访问来自帖子的数据
I'm creating joomla component and i have problem with accesing data from post
在一个视图中,我有6个收件箱,其中3个是由JTable类处理的,这很不错,但是我要处理的其他3个收件箱是我的字段:
in one view i have 6 inboxes 3 of them are chandled by JTable class and thats good, but other 3 i want to process, my fields:
<input id="jform[team1_goals_players]" class="" type="hidden" name="jform[team1_goals_players]" value="2,2," aria-invalid="false">
<input id="jform_team1_goals" class="required" type="text" value="4" name="jform[team1_goals]" aria-required="true" required="required" aria-invalid="false">
第一个是我要处理的字段,第二个是使用
first one is field that i want to process and second is chandled by JTable class by using
$sth = JRequest::get('team1_goals_players');
$ sth为空
我应该使用JRequest获取该值和其他2
where i should use JRequest to get that value and other 2
推荐答案
$sth
为空,因为表单中没有类似team1_goals_players
的变量.您必须像这样尝试-首先获取jform
,然后阅读team1_goals_players
来自jform.
$sth
is empty because there is no variable like team1_goals_players
in the form.You must try like this- first get jform
and then read team1_goals_players
from jform.
$post = JRequest::get('jform');
$sth = $post['team1_goals_players'];
有关 JRequest 的更多信息.
这篇关于joomla获取帖子数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!