简体   繁体   English

使用Joomla中的选择框发送表单操作

[英]Sending form action with select box in joomla

I need to make some modification in joomla module. 我需要在joomla模块中进行一些修改。 I need a select box which select value from database when user select value from that database it redirect user to another page. 我需要一个选择框,当用户从该数据库中选择值时,它会从数据库中选择值,它将用户重定向到另一个页面。 which show result of that page. 显示该页面的结果。 I am able to generate select box with value from database now how i can redirect it to another page of joomla. 我现在能够从数据库生成具有值的选择框,如何将其重定向到joomla的另一页。 Here is code that i used: 这是我使用的代码:

<?php
$db = JFactory :: getDBO();
$query = "select * from #__galleries where parent=0 order by date";
$db->setQuery($query);
$result = $db->loadObjectList();
$options = array();
$options[] = JHTML::_('select.option', '0', '-Select Gallery-');
foreach($result as $row)
{
$options[] = JHTML::_('select.option', $row->id, $row->name);
}
$dropdown = JHTML::_('select.genericlist', $options, 'class="inputbox"', 'name="select"', 'value', 'text');
echo $dropdown; 
?>

Think this code should work. 认为此代码应该工作。 Obviously you will need to adapt it to your needs: 显然,您需要根据需要对其进行调整:

$this->setRedirect( 'LINK_GOES_IN_HERE', $options);

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM