Hello chronoteam,
I have 2 issues with me as below:
1) I have used simple one field form named "email" and checking this email field existence in another table using custom code action and redirecting it to one joomla article.
I have written php code in custom code as follows:-
But somehow "where($db->quoteName('email') . ' = '.$db->quote({text1}));" is not working.
Please suggest on this that how to use the input field variable.
2) I want to add a session value in joomla session through the above php in custom code event. how can i acheive this.
thanks in advance.
I have 2 issues with me as below:
1) I have used simple one field form named "email" and checking this email field existence in another table using custom code action and redirecting it to one joomla article.
I have written php code in custom code as follows:-
<?php
$options = array();
$options['driver'] = 'mysql'; // Database driver name
$options['host'] = 'xxxxx'; // Database host name
$options['user'] = 'xxxxxx'; // User for database authentication
$options['password'] = 'xxxxx'; // Password for database authentication
$options['database'] = 'xxxxxxx'; // Database name
// $options['prefix'] = ''); // probably not needed
?>
{text1}
<?php
die;
$db = & JDatabase::getInstance($options);
$query = $db->getQuery(true);
$query
->select($db->quoteName(array('email')))
->from($db->quoteName('jo_chronoengine_chronoforms_datatable_download-form'))
->where($db->quoteName('email') . ' = '.$db->quote({text1}));
$db->setQuery($query);
$results = $db->loadObjectList();
if(!empty($results)){
header('Location: http://immocosta.be/index.php?option=com_content&view=article&id=122');
}else{
$currentSession = JSession::getInstance('none',array());
$currentSession->set("myvar","ssssss");
header('Location: http://immocosta.be/index.php?option=com_content&view=article&id=123');
}
?>
But somehow "where($db->quoteName('email') . ' = '.$db->quote({text1}));" is not working.
Please suggest on this that how to use the input field variable.
2) I want to add a session value in joomla session through the above php in custom code event. how can i acheive this.
thanks in advance.
Hi Anita,
1. You can't use the curly brackets syntax in PHP - use $form->data['text1'] instead.
2. You can use the Joomla! session methods to get/set values in the User Session.
Bob
1. You can't use the curly brackets syntax in PHP - use $form->data['text1'] instead.
2. You can use the Joomla! session methods to get/set values in the User Session.
<?php
$session = JFactory::getSession();
$session->get('name');
$session->set('name, 'value');
?>
Bob
This topic is locked and no more replies can be posted.
