3060 Posts in 864 Topics by 646 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 812 Views |
-
formular , array

19 May 2010 at 8:32pm Last edited: 19 May 2010 8:54pm
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 )
-
Re: formular , array

19 May 2010 at 9:55pm Last edited: 19 May 2010 9:58pm
there is something wrong with this formular or maby i do not know everything, mail dosen't send
function wycieczka_wyslij() seems not to be executing
i'm using SS 2.4
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'
);$tablica = array(
'tytul' => '',
'data_przyjazdu' => '',
'data_wyjazdu' => '',
'osoby' => '',
'imie' => '',
'email' => '',
'email_powtorz' => '',
'telefon' => '',
'uwagi' => ''
);if($x == "pl") { $tablica = $form_pl; }
$tytul = new HeaderField (
$title = $tablica['tytul'] . ' ' . $this->Title,
$title = $this->Title,
$headingLevel = "2"
);
$tytul->addExtraClass('naglowek');$podroz = new HiddenField(
$name = "podroz",
$title = "Rodzaj podró?y",
$value = $this->Title
);$data_przyjazdu = new DateField(
$name = "data_przyjazdu",
$title = $tablica['data_przyjazdu'],
$value = "DD/MM/YYYY"
);
$data_przyjazdu->addExtraClass('calendar');
$data_przyjazdu->addExtraClass('require');
$data_przyjazdu->addExtraClass('start-date');
$data_przyjazdu->addExtraClass('input_short');
$data_przyjazdu->addExtraClass('label');$data_wyjazdu = new DateField(
$name = "data_wyjazdu",
$title = $tablica['data_wyjazdu'],
$value = "DD/MM/YYYY"
);
$data_wyjazdu->addExtraClass('calendar');
$data_wyjazdu->addExtraClass('require');
$data_wyjazdu->addExtraClass('end-date');
$data_wyjazdu->addExtraClass('input_short');
$data_wyjazdu->addExtraClass('label');
$osoby = new NumericField(
$name = "osoby",
$title = $tablica['osoby'],
$value = "1"
);
$osoby->addExtraClass('require');
$osoby->addExtraClass('input_short');
$osoby->addExtraClass('label');$imie = new TextField(
$name = "imie",
$title = $tablica['imie'],
$value = ""
);
$imie->addExtraClass('require');
$imie->addExtraClass('input_long');
$imie->addExtraClass('label');$email = new EmailField(
$name = "email",
$title = $tablica['email'],
$value = ""
);
$email->addExtraClass('require');
$email->addExtraClass('input_long');
$email->addExtraClass('label');$email_copy = new EmailField(
$name = "powtorz_email",
$title = $tablica['email_powtorz'],
$value = ""
);
$email_copy->addExtraClass('require');
$email_copy->addExtraClass('input_long');
$email_copy->addExtraClass('label');$tel = new TextField(
$name = "tel",
$title = $tablica['telefon'],
$value = ""
);
$tel->addExtraClass('input_long');
$tel->addExtraClass('label');$uwagi = new TextareaField(
$name = "uwagi",
$title = $tablica['uwagi'],
$rows = 3,
$cols = 28
);
$uwagi->addExtraClass('label');$fields = new FieldSet(
$tytul,
$podroz,
$data_przyjazdu,
$data_wyjazdu,
$osoby,
$imie,
$email,
$email_copy,
$tel,
$uwagi
);$actions = new FieldSet(
new FormAction('wycieczka_wyslij', 'Send')
);return new Form($this, 'formularz', $fields, $actions);
}function wycieczka_wyslij($data, $form) {
$imie = $data['imie'];
$email = $data['email'];
$email_copy = $data['email_copy'];
$uwagi = $data['uwagi'];
$ip = $data['ip'];$imie = strtolower($imie);
$email = strtolower($email);
$email_copy = strtolower($email_copy);
$uwagi = strtolower($uwagi);$to = 'myemail@gmail.com';
$subject = "\"" . $this->Title . "\" " . $data['imie'];$message = "Data przyjazdu: " . $data['data_przyjazdu'] . "\n";
$message .= "Data wyjazdu: " . $data['data_wyjazdu'] . "\n";
$message .= "Ilo?? osób: " . $data['osoby'] . "\n";
$message .= "Imi? i nazwisko: " . $data['imie'] . "\n";
$message .= "Telefon: " . $data['tel'] . "\n";
$message .= "Email: " . $data['email'] . "\n";
$message .= "Uwagi: " . $data['uwagi'] . "\n";
$message = eregi_replace("[\]",'',$message);$header = 'From: '.$data['imie']. '<'.$data['email'].'>'."\n";
$header .= 'Content-Type: text/plain; charset=utf-8'."\n";
$header .= 'Content-Transfer-Encoding: 8bit'."\n";
$header .= "MIME-Version: 1.0";mail($to, $subject, $message, $header);
}
| 812 Views | ||
|
Page:
1
|
Go to Top |

