SOLVED: Form displays php error after database creation

ljk 03 Nov, 2010
Hello,

I am using chrono contact 3.1 RC5.5 on a Joomla 1.5.21 site.

The form that I created was working fine without errors. They I created a database table for it and now when I go to the frontend to display the form I get the following error message:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/ifms/public_html/components/com_chronocontact/chronocontact.php(53) : eval()'d code on line 20

If I disable the DB Connection, the error message goes away. I have checked the field names and they don't have any spaced or hyphens in them or start with a number.

The table is named: jos_chronoforms_DetailedRequestQuote.

Is the the SQL for the table that was created:
DROP TABLE IF EXISTS `jos_chronoforms_DetailedRequestQuote`;
CREATE TABLE IF NOT EXISTS `jos_chronoforms_DetailedRequestQuote` (
`cf_id` int(11) NOT NULL auto_increment,
`uid` varchar(255) NOT NULL,
`recordtime` varchar(255) NOT NULL,
`ipaddress` varchar(255) NOT NULL,
`cf_user_id` varchar(255) NOT NULL,
`FirstName` varchar(255) NOT NULL,
`LastName` varchar(255) NOT NULL,
`Title` varchar(255) NOT NULL,
`Company` varchar(255) NOT NULL,
`Address` varchar(255) NOT NULL,
`City` varchar(255) NOT NULL,
`Zip` varchar(255) NOT NULL,
`Phone` varchar(255) NOT NULL,
`Fax` varchar(255) NOT NULL,
`Email` varchar(255) NOT NULL,
`BestTimetoCall` varchar(255) NOT NULL,
`Customer Needs` varchar(255) NOT NULL,
`OrdersPerWeek` varchar(255) NOT NULL,
`SKUs` varchar(255) NOT NULL,
`ItemsPerOrder` varchar(255) NOT NULL,
`ItemCurrency` varchar(255) NOT NULL,
`ItemValue` varchar(255) NOT NULL,
`Weight` varchar(255) NOT NULL,
`WeightValue` varchar(255) NOT NULL,
`Measurement` varchar(255) NOT NULL,
`PieceLength` varchar(255) NOT NULL,
`PieceWidth` varchar(255) NOT NULL,
`PieceHeight` varchar(255) NOT NULL,
`TargetCustomer` varchar(255) NOT NULL,
`TargetGeoCountry` varchar(255) NOT NULL,
`TargetGeo` varchar(255) NOT NULL,
`ReportingRequirementsType` varchar(255) NOT NULL,
`CompanyDescription` text NOT NULL,
`CompanyProduct` text NOT NULL,
`NeedsDescription` text NOT NULL,
`ReportingRequirements` text NOT NULL,
`Comments` text NOT NULL,
`State` varchar(255) NOT NULL,
`Country` varchar(255) NOT NULL,
`PreferContactBy` varchar(255) NOT NULL,
`ReferredBy` varchar(255) NOT NULL,
PRIMARY KEY (`cf_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Any idea what is causing the php error?

Thank you.
GreyHead 03 Nov, 2010
Hi ljk,

All that looks fine. Please try refreshing the DB Connection in case there is some old code in there.

In the Form Editor click the DB Connection tab and set the Connection to 'No'. Click the 'Apply icon in the toolbar to save the form, open the DB Connection tab, set the Connection back to 'Yes' and re-save the form. This will refresh the copy of the table information that ChronoForms uses.

Bob
ljk 08 Nov, 2010
Hi Bob,

I already tried to do that a couple of times. It doesn't make any difference, as soon as you enable the DB connection you get the php error back.

Any other suggestions or information that could help?

Thank you.
GreyHead 08 Nov, 2010
Hi ljk ,

Please post a link to the form so we can take a quick look.

Bob
ljk 08 Nov, 2010
Hi Bob,

Here is the link: removed.

Thanks,
Laurelle
GreyHead 08 Nov, 2010
Hi Laurelle,

Hmm . . still looks perfectly good to me. The error is coming from this line
eval ("?>".$MyForm->formrow->dbclasses);
so it has to be from the DB Connection/Autogenerated code.

Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.

Bob
ljk 08 Nov, 2010
Hi Bob,

I really appreciate your help on this.

Form is attached. [Attachment removed]

Thank you.
GreyHead 09 Nov, 2010
Hi Laurelle,

Oops - please may I have the form code as well
{source}[[? include('content/detailed_quote.php'); ?]]{/source}


Bob
ljk 09 Nov, 2010
Hi,

Sorry about that. Form code is attached.

Attachment removed
GreyHead 09 Nov, 2010
Hi Laurelle,

Found it I think. There's a space in this input name:
<input id="Customer Needs" name="Customer Needs" value="====================================" type="hidden" />


Change the input name and the database column name then refresh the connection (see below) and all should be well.

Bob

PS Which plug-in uses {source} ? just curious

You need to refresh the DB Connection after any changes to database column names. In the Form Editor click the DB Connection tab and set the Connection to 'No'. Click the 'Apply icon in the toolbar to save the form, open the DB Connection tab, set the Connection back to 'Yes' and re-save the form. This will refresh the copy of the table information that ChronoForms uses.
ljk 09 Nov, 2010
Hi Bob,

Thank you so much. That is embarassing, it looked through all of the none hidden fields, but didn't check the hidden one. I actually had to remove the field from the database table to get rid of the error. Just changing the name of the field and doing the DB Connection No, Save and then DB Connection Yes and Save didn't change the name of the table field.

The plugin sourcer (http://www.nonumber.nl/extensions/sourcerer) uses {source}. It is a great plugin for adding php, Javascript to your content. The best thing about it is that you can change < and > tags to [[ and ]] so your code doesn't get eaten by the WYSIWIG editor.

Will try get this client to buy a license.

Thanks again so much for your help.
GreyHead 09 Nov, 2010
Hi Laurelle,

No problem. I found it by digging the Table code that ChronoForms generates out of the database and putting it into Dreamweaver - which then highlighted a syntax error.

Sourcerer looks useful I use Jumi a lot but Sourcerer may work in places that Jumi doesn't.

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