我正在创建joomla组件,我在从帖子
访问数据时遇到问题在一个视图中,我有6个收件箱,其中3个由JTable类推销,这很好,但其他3我想处理,我的字段:
<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">
第一个是我要处理的字段,第二个是由JTable类使用
进行处理$sth = JRequest::get('team1_goals_players');
$ sth为空
我应该使用JRequest获取该值和其他2
答案 0 :(得分:8)
在2.5中弃用了JRequest。
$jinput = JFactory::getApplication()->input;
$post = $jinput->get('jform', array(), 'array');
$sth = $post['team1_goals_players'];
答案 1 :(得分:2)
$sth
为空,因为表单中没有team1_goals_players
之类的变量。您必须尝试这样做 - 首先获取jform
,然后从jform中读取team1_goals_players
。< / p>
$post = JRequest::get('jform');
$sth = $post['team1_goals_players'];
有关JRequest的更多信息。