Parse error, please help me...

Sk SkuD 05 Jun, 2009
Hi all,

I created my form but when I see it in fronted there is an error :

Parse error: syntax error, unexpected '-', expecting '{' in /homez.145/akobaftp/www/components/com_chronocontact/chronocontact.php(45) : eval()'d code on line 3

I try to stop message error in Joomla configuration but the error is always here.


My file chronocontact.php :

<?php
/**
* CHRONOFORMS version 3.1
* Copyright (c) 2006 Chrono_Man, ChronoEngine.com. All rights reserved.
* Author: Chrono_Man (ChronoEngine.com)
* See readme.html.
* Visit http://www.ChronoEngine.com for regular update and information.
**/

/* ensure that this file is called by another file */
defined('_JEXEC') or die('Restricted access');

/**
* Load the HTML class
*/
require_once( JApplicationHelper::getPath( 'front_html' ) );
require_once( JApplicationHelper::getPath( 'class' ) );

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
//load chronoforms classes
require_once( JPATH_COMPONENT.DS.'libraries'.DS.'chronoform.php');
require_once( JPATH_COMPONENT.DS.'libraries'.DS.'mails.php');
require_once( JPATH_COMPONENT.DS.'libraries'.DS.'customcode.php');
require_once( JPATH_COMPONENT.DS.'libraries'.DS.'chronoformuploads.php');
require_once( JPATH_COMPONENT.DS.'libraries'.DS.'plugins.php');




jimport( 'joomla.application.component.controller' );
global $mainframe;
$CFDBO =& JFactory::getDBO();
$formname = JRequest::getVar( 'chronoformname');
if ( !$formname ) {
$params =& $mainframe->getPageParameters('com_chronocontact');
$formname = $params->get('formname');
}

$MyForm =& CFChronoForm::getInstance($formname);

if($MyForm->formparams('dbconnection') == "Yes"){
eval ("?>".$MyForm->formrow->dbclasses);
}

$posted = JRequest::get( 'post' , JREQUEST_ALLOWRAW );
/**
* Main switch statement
*/
switch( $task ) {
case 'send':
uploadandmail();
break;
case 'extra':
doextratask();
break;
default:
showform($posted);
break;
}
/**
* End of main page
*
*/

/**
* Display the form for entry
*
*/
function showform($posted)
{
global $mainframe;
$database =& JFactory::getDBO();

$formname = JRequest::getVar( 'chronoformname');
if ( !$formname ) {
$params =& $mainframe->getPageParameters('com_chronocontact');
$formname = $params->get('formname');
}
$MyForm =& CFChronoForm::getInstance($formname);
$MyForm->showForm($formname, $posted);
//HTML_ChronoContact::showform( $MyForm->formrow, $posted);
}

/**
* Respond to a submitted form
*
*/
function uploadandmail()
{
global $mainframe;
$database =& JFactory::getDBO();
$posted = JRequest::get( 'post' , JREQUEST_ALLOWRAW );

// Block SPAM through the submit URL
if(!JRequest::checkToken()){
echo "You are not allowed to access this URL";
return;
}
if ( empty($posted) ) {
echo "You are not allowed to access this URL directly, POST array is empty";
return;
}

//Load Chronoforms Classes
$formname = JRequest::getVar( 'chronoformname');
if ( !$formname ) {
$params =& $mainframe->getPageParameters('com_chronocontact');
$formname = $params->get('formname');
}
$MyForm =& CFChronoForm::getInstance($formname);
$MyFormData = $MyForm->getForm(JRequest::getVar( 'chronoformname'));
if($MyFormData){
//fine
}else{
$mainframe->enqueueMessage('Error processing this form, form was not loaded!');
return;
}

if(JRequest::getVar('action') == 'extra'){
$extraid = JRequest::getVar( 'extraid');
$MyForm->doExtra($MyForm->formrow->name, $extraid, $posted);
}

$MyForm->submitForm($MyForm->formrow->name);
}

function doextratask(){
global $mainframe;
$database =& JFactory::getDBO();
$posted = JRequest::get( 'post' , JREQUEST_ALLOWRAW );
$formname = JRequest::getVar( 'chronoformname');
if ( !$formname ) {
$params =& $mainframe->getPageParameters('com_chronocontact');
$formname = $params->get('formname');
}
$MyForm =& CFChronoForm::getInstance($formname);
$extraid = JRequest::getVar( 'extraid');
$MyForm->doExtra($formname, $extraid, $posted);
}
?>


Please help me I need this Form for this evening...

Best Regards.
Max_admin Max_admin 05 Jun, 2009
Hi Skud,

one of your form fields names has "-" inside it and you created a table with one of the fields name has "-" and so this is causing that, first go to the DB connection tab and unselect that table and fix your field name then create a new table with all names don't have any "-"s then connect to this new table!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Sk SkuD 05 Jun, 2009
Thanks Max. All it's good.

😀
pa pat01 10 Jun, 2009
After upgrading to RC5.1 I get the following error:

Fatal error: Call to a member function getPageParameters() on a non-object in chronoform.php on line 40

I have no "-" in the field names. this error only happens on my multi page form (created with the wizard), not on the regular "one page" form. I use Joomla! 1.5.10.

What causes this?

Thank you very much!

Patrick
pa pat01 11 Jun, 2009
Thank you, Bob.

Patrick
This topic is locked and no more replies can be posted.