I'm trying to make a simple contact form but I can't pass params from my module to external action="contact.php"
file.
This is how I'm trying to get parameters to an external file:
$app = JFactory::getApplication('site');
$app->initialise();
$session = JFactory::getSession();
jimport( 'joomla.application.module.helper' );
$db = JFactory::getDBO();
$db->setQuery("SELECT params FROM #__modules WHERE module = 'mod_my_contact_form'");
$module = $db->loadObject();
$params = new JRegistry($module->params);
$contact_email = $params->get('myemail');
Result of the print_r('My e-mail: ' . $contact_email);
stays empty:
My e-mail:
What might be the cause of this issue?
EDIT: I've tried that method but without any results:
$app = JFactory::getApplication('site');
$app->initialise();
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule('mod_my_contact_form');
$registry = new JRegistry();
$params = $registry->loadString($module->params);
$contact_email = $params->get('myemail');
EDIT 2:
File structure:
mod_my_contact_form/
tmpl/
includes/
contact.php
default.php
helper.php
mod_my_contact_form.php
mod_my_contact_form.xml
EDIT 3: I think the xml is built properly. This is how looks the param part:
...
...
<fieldset name="contact_form" label="Contact Form">
<field name="myemail" type="email" label="JGLOBAL_EMAIL" description="E-mail where you will receive all messages" size="30" class="inputbox" validate="email" />
</fieldset>
</fields>
</config>
</extension>