我一直被困在这个问题上,不知道为什么这不起作用。
我正在使用 Joomla 2.5 并构建自己的组件。
我有一个“书籍”和“书籍”视图。“书籍”列出了数据库中的所有书籍,“书籍”是我添加/编辑书籍项目的地方。我正在尝试将值从“书籍”传递到“书籍”,但它不起作用。
我已经设置了一个带有要传递的值的输入文本。
<input type="text" id="test" name="test" value="testvalue" />
意见/书籍/tmpl/default.php
<form action="<?php echo JRoute::_('index.php?option=com_test'); ?>" method="post" name="adminForm">
<table class="adminlist">
<thead><?php echo $this->loadTemplate('head');?></thead>
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
<tbody><?php echo $this->loadTemplate('body');?></tbody>
</table>
<div>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHtml::_('form.token'); ?>
<!-- For sorting -->
<input type="hidden" name="filter_order" value="<?php echo $this->sortColumn; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->sortDirection; ?>" />
<input type="text" id="test" name="test" value="testvalue" />
</div>
</form>
在我的书 view.html.php 文件中,views/book/view.html.php
$jinput = JFactory::getApplication()->input;
echo 'value:'.$jinput->get('test');
不会有任何价值。我试过 $_POST('test') 但它仍然不起作用。谁能指出我正确的方向?