Greetings,
I have had great success creating forms using your tutorials, however when I attempted to include a field to upload an image for a photo contest, I ran into problems.
The form looks great, yet as soon as I hit submit I receive the following error message "Illegal key characters in global data." I am unable to use "debug" so I am stuck. I'm sure it is something I did incorrectly, however, since I was unable to find a tutorial on how to use the new actions for Cv4 I don't know how to procede.
Any help would be appreciated.
Regards,
William
I have had great success creating forms using your tutorials, however when I attempted to include a field to upload an image for a photo contest, I ran into problems.
The form looks great, yet as soon as I hit submit I receive the following error message "Illegal key characters in global data." I am unable to use "debug" so I am stuck. I'm sure it is something I did incorrectly, however, since I was unable to find a tutorial on how to use the new actions for Cv4 I don't know how to procede.
Any help would be appreciated.
Regards,
William
Greetings Bob,
Thank you for responding to my post. I did more research and found that jHackGuard was causing the problem. They recommended disabling "Filter $_POST" "Filter $_GET" and "Filter $_COOKIE" and this resolved the problem.
However, I have a new problem. After integrating Database Save I receive the following error messages when submitting the form:
Parse error: syntax error, unexpected '&', expecting ',' or ';' in /home/legendso/public_html/administrator/components/com_chronoforms/form_actions/db_save/db_save.php(62) : eval()'d code on line 10
Fatal error: Call to a member function bind() on a non-object in /home/legendso/public_html/administrator/components/com_chronoforms/form_actions/db_save/db_save.php on line 85
I read in the forum that others have had similar issues so I followed your instructions to remove symbols from the form name, yet I still have issues. I hope you can help me resolve my problem.
Thank you in advance.
Regards,
William
Thank you for responding to my post. I did more research and found that jHackGuard was causing the problem. They recommended disabling "Filter $_POST" "Filter $_GET" and "Filter $_COOKIE" and this resolved the problem.
However, I have a new problem. After integrating Database Save I receive the following error messages when submitting the form:
Parse error: syntax error, unexpected '&', expecting ',' or ';' in /home/legendso/public_html/administrator/components/com_chronoforms/form_actions/db_save/db_save.php(62) : eval()'d code on line 10
Fatal error: Call to a member function bind() on a non-object in /home/legendso/public_html/administrator/components/com_chronoforms/form_actions/db_save/db_save.php on line 85
I read in the forum that others have had similar issues so I followed your instructions to remove symbols from the form name, yet I still have issues. I hope you can help me resolve my problem.
Thank you in advance.
Regards,
William
Hi William,
Please check the input names in the form as well as the form name. No dashes, spaces or other special characters apart from underscore.
Bob
Please check the input names in the form as well as the form name. No dashes, spaces or other special characters apart from underscore.
Bob
Greetings Bob,
I originally had an "&" sign in the field but had removed it some time back. I have followed the link to the db_save php, but I really don't know what I'm looking for as I am just learning php. I thought it might be helpful if I pasted the information below.
Thanks,
William
I originally had an "&" sign in the field but had removed it some time back. I have followed the link to the db_save php, but I really don't know what I'm looking for as I am just learning php. I thought it might be helpful if I pasted the information below.
<?php
/**
* CHRONOFORMS version 4.0
* Copyright (c) 2006 - 2011 Chrono_Man, ChronoEngine.com. All rights reserved.
* Author: Chrono_Man (ChronoEngine.com)
* @license GNU/GPL
* Visit http://www.ChronoEngine.com for regular updates and information.
**/
class CfactionDbSave{
var $formname;
var $formid;
var $group = array('id' => 'db_operations', 'title' => 'DB Operations');
var $details = array('title' => 'DB Table save', 'tooltip' => 'Save some data to some database table name.');
function run($form, $actiondata){
global $mainframe;
$database =& JFactory::getDBO();
$params = new JParameter($actiondata->params);
//check if a different database connection is needed
if($params->get('ndb_enable', 0)){
$option = array();
$option['driver'] = $params->get('ndb_driver', 'mysql');// Database driver name
$option['host'] = $params->get('ndb_host', 'localhost');// Database host name
$option['user'] = $params->get('ndb_user', '');// User for database authentication
$option['password'] = $params->get('ndb_password', '');// Password for database authentication
$option['database'] = $params->get('ndb_database', '');// Database name
$option['prefix'] = $params->get('ndb_prefix', 'jos_');// Database prefix (may be empty)
$database = & JDatabase::getInstance($option);
$params->set('table_name', $params->get('ndb_table_name', ''));
}
//end new db connection
$table_name = $params->get('table_name', '');
if(!empty($table_name)){
$model_id = $params->get('model_id', '');
if(empty($model_id)){
$model_id = 'chronoform_data';
}
//generate a dynamic model for the table
$result = $database->getTableFields(array($table_name), false);
$table_fields = $result[$table_name];
$dynamic_model_code = array();
$dynamic_model_code[] = "<?php";
$dynamic_model_code[] = "if (!class_exists('Table".str_replace($mainframe->getCfg('dbprefix'), '', $table_name)."')) {";
$dynamic_model_code[] = "class Table".str_replace($mainframe->getCfg('dbprefix'), '', $table_name)." extends JTable {";
$primary = 'id';
foreach($table_fields as $table_field => $field_data){
$dynamic_model_code[] = "var \$".$table_field." = null;";
if($field_data->Key == 'PRI')$primary = $table_field;
}
$dynamic_model_code[] = "function __construct(&\$database) {";
if($params->get('ndb_enable', 0)){
$dynamic_model_code[] = "\$db_inst = JDatabase::getInstance(".var_export($option, true).");";
$dynamic_model_code[] = "parent::__construct('".$table_name."', '".$primary."', \$db_inst);";
}else{
$dynamic_model_code[] = "parent::__construct('".$table_name."', '".$primary."', \$database);";
}
$dynamic_model_code[] = "}";
$dynamic_model_code[] = "}";
$dynamic_model_code[] = "}";
$dynamic_model_code[] = "?>";
$dynamic_model = implode("\n", $dynamic_model_code);
eval("?>".$dynamic_model);
//load some variables
$user =& JFactory::getUser();
$defaults = array(
'cf_uid' => md5(uniqid(rand(), true)),
'cf_created' => date('Y-m-d H:i:s', time()),
'cf_ipaddress' => $_SERVER["REMOTE_ADDR"],
'cf_user_id' => $user->id
);
$row = JTable::getInstance(str_replace($mainframe->getCfg('dbprefix'), '', $table_name), 'Table');
if((int)$params->get('save_under_modelid', 0) != 1 && !isset($form->data[$model_id])){
$form->data[$model_id] = $form->data;
}
if(!isset($form->data[$model_id])){
$form->data[$model_id] = array();
}
//check if new record or updated one
if(isset($form->data[$model_id][$primary]) && !empty($form->data[$model_id][$primary])){
//don't merge, just set a modified date
$form->data[$model_id] = array_merge(array('cf_modified' => date('Y-m-d H:i:s', time())), $form->data[$model_id]);
}else{
$form->data[$model_id] = array_merge($defaults, $form->data[$model_id]);
}
if(!$row->bind($form->data[$model_id])){
$form->debug[] = $row->getError();
}
if(!$row->store()){
$form->debug[] = $row->getError();
}
$form->data[$model_id][$primary] = $form->data[strtolower($model_id.'_'.$primary)] = $row->$primary;
}
}
function load_tables(){
//print_r2($_GET);
$option = array();
$option['driver'] = JRequest::getVar('dbdriver', 'mysql');// Database driver name
$option['host'] = JRequest::getVar('dbhost', 'localhost');// Database host name
$option['user'] = JRequest::getVar('dbuser', '');// User for database authentication
$option['password'] = JRequest::getVar('dbpass', '');// Password for database authentication
$option['database'] = JRequest::getVar('dbname', '');// Database name
$option['prefix'] = JRequest::getVar('dbprefix', 'jos_');// Database prefix (may be empty)
//print_r2($option);
$database = & JDatabase::getInstance($option);
$tables = $database->getTableList();
$options = array();
foreach($tables as $table){
$options[$table] = $table;
}
return implode(",", $options);
}
function load($clear){
if($clear){
$action_params = array(
'table_name' => '',
'enabled' => 1,
'model_id' => 'chronoform_data',
'save_under_modelid' => 0,
'ndb_enable' => 0,
'ndb_driver' => 'mysql',
'ndb_host' => 'localhost',
'ndb_user' => '',
'ndb_password' => '',
'ndb_database' => '',
'ndb_table_name' => '',
'ndb_prefix' => 'jos_'
);
}
return array('action_params' => $action_params);
}
}
?>Thanks,
William
Hi Willaim,
I'm afraid that code doesn't help at all. Did you also remove the & from the database column name?
Bob
I'm afraid that code doesn't help at all. Did you also remove the & from the database column name?
Bob
This topic is locked and no more replies can be posted.
