hi
i have one formular for 8 languages
here is the fragment
function formularz($x) {
$form_pl = array(
'tytul' => 'Formularz rezerwacji:',
'data_przyjazdu' => 'Data przyjazdu',
'data_wyjazdu' => 'Data wyjazdu',
'osoby' => 'Ilo?? osób',
'imie' => 'Imi? i nazwisko',
'email' => 'Email',
'email_powtorz' => 'Powtórz e-mail',
'telefon' => 'Tel.',
'uwagi' => 'Uwagi'
);
$form_en = array(
'tytul' => 'Application form:',
'data_przyjazdu' => 'Arrival date',
'data_wyjazdu' => 'Departure date',
'osoby' => 'Number of participants',
'imie' => 'Name and surname',
'email' => 'Email',
'email_powtorz' => 'Repeat your e-mail',
'telefon' => 'Tel.',
'uwagi' => 'Request'
);
if($x == "pl") { $array = $form_pl; }
if($x == "en") { $array = $form_en; }
$title = new HeaderField (
$title = $array['tytul'] . ' ' . $this->Title,
$title = $this->Title,
$headingLevel = "2"
);
$tytul->addExtraClass('naglowek');
$fields = new FieldSet(
.....
}
$actions = new FieldSet(
new FormAction('wycieczka_wyslij', 'Send')
);
return new Form($this, 'formularz', $fields, $actions);
}
function wycieczka_wyslij($data) {
$imie = $data['imie'];
$email = $data['email'];
$email_copy = $data['email_copy'];
$uwagi = $data['uwagi'];
....
mail($to, $subject, $message, $header);
}
in template i put the variable for x
formularz(pl) / formularz(en) / formularz(it) etc.
everything works good, i get correct array in template but when i try to send the form a get an error
[Notice] Undefined variable: array
329 $title = new HeaderField (
330 $title = $array['tytul'] . ' ' . $this->Title,
331 $title = $this->Title,
332 $headingLevel = "2"
333 );
EDIT:
trying
$array = array();
now have notice
[Notice] Undefined index: tytul
$title = $array['tytul'] . ' ' . $this->Title,
print_r($array); // FR formular
Array ( [tytul] => Formulaire du contact: [data_przyjazdu] => Arrivée [data_wyjazdu] => Départ [osoby] => Le nombre de personnes [imie] => Nom et prénom => Email [email_powtorz] => Répétez votre e-mail [telefon] => Téléphone [uwagi] => Commentaires )