getError());}if (!class_exists('Tablechronoforms_newsletter_signup')) {class Tablechronoforms_newsletter_signup extends JTable{var $cf_id = null;var $uid = null;var $recordtime = null;var $ipaddress = null;var $cf_user_id = null;var $name = null;var $email = null;function __construct( &$database ) {parent::__construct( '#__chronoforms_newsletter_signup', 'cf_id', $database );}}}?>I hope somebody can help me.Thank you in advance!Regards,Afanasie"> Send data from ChronoForm to Newsletter Table DB? - Forums

Forums

Send data from ChronoForm to Newsletter Table DB?

ihtus 26 Jan, 2011
Hi Chrono Team!

I need your help.
I have ChronoForm with 2 input boxes: Name and Email.

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label">Navn <span class="req">*</span></label>
    <input class="cf_inputbox required" maxlength="150" size="30" title="" id="text_0" name="text_0" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>



<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label">Email <span class="req">*</span></label>
    <input class="cf_inputbox required validate-email" maxlength="150" size="30" title="" id="email" name="email" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>


After the button "send" is pressed, I need to send the information inserted into that fields to a Newsletter Component Table DB - AcyMailing or CCNewsletter.

Below is the Table Structure with Name and Email for AcyMailing and CCNewsletter





I followed ChronoForms saving to a database table.pdf but I am still confused what php code should I use.

In ChronoForms saving to a database table.pdf I found the following code, but how can I addapt that code for taking the information from text input and send and save it into a specific table structure (acymailing and ccnewsletter)

<?php
$data = array();
$data['cf_id'] = 99;
$data['name'] = 'John Smith';
$record =& JTable::getInstance("chronoforms_newsletter_signup", "Table");
if ( !$record->save($data) ) {
JError::raiseWarning(100, $record->getError());
}
if (!class_exists('Tablechronoforms_newsletter_signup')) {
class Tablechronoforms_newsletter_signup extends JTable
{
var $cf_id = null;
var $uid = null;
var $recordtime = null;
var $ipaddress = null;
var $cf_user_id = null;
var $name = null;
var $email = null;
function __construct( &$database ) {
parent::__construct( '#__chronoforms_newsletter_signup', 'cf_id', $database );
}
}
}
?>



I hope somebody can help me.

Thank you in advance!

Regards,
Afanasie
Max_admin 27 Jan, 2011
Hi,

Just select the table under the DB Connection tab and set "enable" to yes and it should save the data there.

You should set the run order to "after email", and change your form fields names to "name" and "email" instead of "text_0"

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
ihtus 27 Jan, 2011
Max thanks for your reply!
I got ChronoForms saving to a database table.pdf from here http://greyhead.net/how-to-docs/chronoforms-saving-to-a-database-table

What about the phpcode? cf_id? name? I thought it must be changed as well.
$data['cf_id'] = 99;
$data['name'] = 'John Smith';

<?php
$data = array();
$data['cf_id'] = 99;
$data['name'] = 'John Smith';
$record =& JTable::getInstance("chronoforms_newsletter_signup", "Table");
if ( !$record->save($data) ) {
JError::raiseWarning(100, $record->getError());
}
if (!class_exists('Tablechronoforms_newsletter_signup')) {
class Tablechronoforms_newsletter_signup extends JTable
{
var $cf_id = null;
var $uid = null;
var $recordtime = null;
var $ipaddress = null;
var $cf_user_id = null;
var $name = null;
var $email = null;
function __construct( &$database ) {
parent::__construct( '#__chronoforms_newsletter_signup', 'cf_id', $database );
}
}
}
?>
GreyHead 30 Jan, 2011
Hi afanasie,

You only need the code from the How-To document in situations where you can't use the ChronoForms DB Connection for one reason or another.

ChronoForms’ DB Connection feature provides and easy way of saving form data to a database table. However, sometimes you need to create custom code to save or update a record.


From what you've posted here the DB Coonnection will work OK provided that you take care to match up the input and column names.

Bob
ihtus 30 Jan, 2011
Dear Bob and Max
thank you! I didn't think it's so simple and no code needed🙂
Thanks again!
Chacapamac 02 Jun, 2011
I will look at that post because I like to learn how to make interact a chrono registration and Acymailing
Koichi 04 Aug, 2011
I am working on the same, Im trying to get info from signup for newsletter form to acyMailling.
I've chosen the table, but giving me
"Warning: implode() [function.implode]: Invalid arguments passed in /homepages/38/d364298448/htdocs/SoccerPeeps/JoomSoccer/libraries/joomla/database/database/mysql.php on line 540"

any idea?
GreyHead 05 Aug, 2011
Hi Koichi ,

You don't say how or where this is happening which makes it a bit hard to diagnose.

That line in the code has two implodes, one of field-names and one of values - so at least one of these is empty.

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