![](/img/trans.png)
[英]How to pass a value from default.php to view.html.php through ajax - joomla3.x
[英]passing variable as hidden from default.php is not working - joomla 3
您好,我是模块开发的新手。 我需要知道如何将变量从tmpl / default.php传递给mod_.php,因为我无法从参考的教程中获得它。 这就是我使用的方式:
tmpl/default.php (not the full code)
<form action="index.php" method="post" id="sc_form">
<input type="hidden" name="form_send" value="send" />
<label>Your name:</label><br/>
<input type="text" name="your_name" value="" size="40" /><br/><br/>
<label>Your question:</label><br/>
<textarea name="your_question" rows="5" cols="30"></textarea><br/><br/>
<input type="submit" name="send" value="Send" />
</form>
-----------------------------------------------------------------------------------
mod_modulename.php
$form_send = JRequest::getVar('form_send', 'notsend');
switch($form_send){
case 'send':
require(JModuleHelper::getLayoutPath('mod_<module_name>', 'sendok'));
break;
default:
require(JModuleHelper::getLayoutPath('mod_<module_name>', 'default'));
}
非常感谢您的考虑。 这将对我有很大的帮助...
JRequest
方法在3中已弃用。请改用JInput
。 例如:
$input = JFactory::getApplication()->input;
$form_send = $input->get('form_send', 'notsend');
希望能帮助到你
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.