Forums

Parse error: syntax error, unexpected ':'

magicbag 08 Jun, 2009
Hi

I created the DB connection and no problem, but when I select yes to use DB I get this error on the form page

Parse error: syntax error, unexpected ':', expecting ',' or ';' in /home/lalabor4/public_html/new/components/com_chronocontact/chronocontact.php(42) : eval()'d code on line 14

I chewck the file on line 42 and there is not a ":", here is the code on the file:

<?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);}  /** this is the line 42 **/

$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);
}
?>


thanks on advance

Richard
GreyHead 08 Jun, 2009
Hi Richard,

It's actually line 14 of the DB Connections code where the problem lies - do you have a field name with a ':' in it?

Bob
magicbag 08 Jun, 2009
hello

thanks for the fast replay.

I check the form code and I remove all the ":" was posible romove and still the same, I don't know if is the style="width can be the problem, here is the form code

<div class="cfclear"> </div>


<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;" ><font color="#cc0000"><font color="#cc0000">* </font> </font>Officer's Name</label>
    <input class="cf_inputbox required" maxlength="150" size="40" title="" id="text_3" name="Name" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;"><font color="#cc0000">* </font>DC or Affiliate Name</label>
    <input class="cf_inputbox required" maxlength="150" size="40" title="" id="text_4" name="DC_name" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;"><font color="#cc0000">* </font>Address</label>
    <input class="cf_inputbox required" maxlength="150" size="40" title="" id="text_5" name="Addresss" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;"><font color="#cc0000">* </font>City</label>
    <input class="cf_inputbox required" maxlength="150" size="40" title="" id="text_6" name="City" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;"><font color="#cc0000">* </font>State</label>
    <input class="cf_inputbox required" maxlength="150" size="20" title="" id="text_7" name="State" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;"><font color="#cc0000">* </font>Zip</label>
    <input class="cf_inputbox required validate-number" maxlength="15" size="30" title="" id="text_8" name="Zip" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;"><font color="#cc0000">* </font>Phone</label>
    <input class="cf_inputbox required" maxlength="150" size="30" title="" id="text_9" name="Phone" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;"><font color="#cc0000">* </font>Email (internal use)</label>
    <input class="cf_inputbox required validate-email" maxlength="150" size="40" title="Email" id="text_10" name="Email" type="text" />
   
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="width: 150px;">Your local's trade</label>
    <textarea class="cf_inputbox" rows="3" id="text_12" title="" cols="40" name="Local_trade"></textarea>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_captcha">
    <label class="cf_label" style="width: 150px;">Type the code</label>
    <span>{imageverification}</span> 
    
    </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_button">
    <input value="Submit" name="button_15" type="submit" />
  </div>
  <div class="cfclear"> </div>
</div>
magicbag 08 Jun, 2009
ok I remove all the ":" from the form and still same
magicbag 08 Jun, 2009
SOLVED

The ":" was on the DB filds, now is working good, Thanks for the clues

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