Mail headers

Discuss everything related to FormBuilder. All versions. Any questions related to the FormBuilder developing or using should be posted to this forum.

Moderators: alexandrleonenko, goas

lapuella
Junior
Junior
Posts: 11
Joined: Sep 12th, '13, 18:08

Re: Mail headers

Postby lapuella » Dec 3rd, '13, 21:26

I use version 2.0.1. I believe this is the latest version.
When I use the code suggested on another topic (viewtopic.php?f=75&t=4344), I get also a Fatal error: Call to a member function SetEmailSubject() on a non-object in ....

This is the code I use:

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Aanmelden Nieuwsbrief </title>
<link href="css/style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<?php
require_once '../formbuilder.php';

try {
$form = new FB_Form('nieuwsbrief');
if($form->IfSubmitted()){
$form->SetSuccessMsg('<div class="alert alert-success">Het formulier is succesvol verzonden!');
}
$form->SendResultAsEmail() //you allow the results to be sent
->AddEmailAddress("info@domain.com", "contact@domain.com") // you set the emails where to send them to
->AddEmailContent("Date: ".date("Y-m-d") // you can add any kind of content to your letter
->SetEmailSubject("Aanmelding nieuwsbrief")); // you can set a subject for letter

$form->getEmail() // you will get letter object
->SetFrom($from); // set a 'from' header


$form->AddTextField('Email', 'Email')
->IsEmail()
->IsRequired(1);

$form->AddRadioButton('Aanhef', 'Aanhef', array('Mevrouw'=>'Mevrouw', 'Heer'=>'Heer'));

$form->AddTextField('Voornaam', 'Voornaam')
->IsAlphabetic()
->AddAllowedSpecialCharacters('-', '\'')
->IsSpacesAllowed(1)
->IsPointingAllowed(0)
->IsRequired(1)
->SetFieldSize(30);
$form->AddTextField('Tussenvoegsel', 'Tussenvoegsel')
->AddAllowedSpecialCharacters('-', '\'')
->IsSpacesAllowed(1)
->IsAlphanumeric()
->IsPointingAllowed(0)
->SetFieldSize(30);
$form->AddTextField('Achternaam', 'Achternaam')
->AddAllowedSpecialCharacters('-', '\'')
->IsSpacesAllowed(1)
->IsPostcode(1)
->IsPointingAllowed(0)
->IsRequired(1)
->SetFieldSize(30);




//SUBMIT BUTTON
$form->AddSubmitButton('submit_button', 'Verzenden');
echo $form->GetHtml();

} catch (Exception $e) {
FB_Debug::OnException($e);
}

?>
</body>
</html>

Do you see what I am doing wrong?

administrator
Site Admin
Site Admin
Posts: 6180
Joined: Jan 7th, '09, 23:18
Contact:

Re: Mail headers

Postby administrator » Dec 4th, '13, 08:15

1. Next time please use [ code ] tags to place your code inside.
2. You have unexpected ) in your code. Valid code is:

Code: Select all

   
$form->SendResultAsEmail() //you allow the results to be sent
    ->AddEmailAddress("info@domain.com", "contact@domain.com") // you set the emails where to send them to
    ->AddEmailContent("Date: ".date("Y-m-d")) // you can add any kind of content to your letter
    ->SetEmailSubject("Aanmelding nieuwsbrief"); // you can set a subject for letter

lapuella
Junior
Junior
Posts: 11
Joined: Sep 12th, '13, 18:08

Re: Mail headers

Postby lapuella » Dec 5th, '13, 20:35

Thank you, it works now! :)

I copied the unexpected ) code with error from: viewtopic.php?f=75&t=4344
Maybe you can change the code there.


Return to “ApPHP FormBuilder {developers/users}”