send site language to database

lydiab 17 Sep, 2012
Hello,

I am working on a multi-language site (french, italian and english : zanzibar-holiday.com) and using chronoforms to get info from users and send it to a database.
I use a separate forms for each language. Everything is working well.

All data, regardless of the language go in the same table of the database but there is no way of knowing what form (what language) users filed.
I would like to be able to identify and load in the database if they used the french, italian or english form, without asking.

Any recommandation ? Should I try to use a hidden field ?
thanks
Lydia
GreyHead 17 Sep, 2012
Hi Lydia,

You don't need separate forms but sometimes this is simpler.

You can get the form name from a Custom Code action with code like this:
<?php
$form->data['form_name'] = $form->form_details->name;
?>
or you can get the current language tag using
<?php
$lang =& JFactory::getLanguage();
$form->data['lang_tag'] = $lang->getTag();
?>

Bob
lydiab 17 Sep, 2012
It is working fine using the code you provided,
thanks
This topic is locked and no more replies can be posted.