简体   繁体   中英

passing variable as hidden from default.php is not working - joomla 3

hi im new on module development. i need to know how to pass a variable from tmpl/default.php to mod_.php since i couldnt achive it from the tutorials that i have reffered. this is how i used:

 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'));

}

thank you very very much for consideration. this will be a great great help for me...

The JRequest method is deprecated in 3. Use JInput instead. Ex:

$input = JFactory::getApplication()->input;
$form_send  = $input->get('form_send', 'notsend');

Hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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