Forums

Problems with composing e-mail parts using custom code

taro8 10 Sep, 2015
Im making an email with is supposed to include some form info, but only if certain checkbox is checked (fakturatak). If so then depending on a radio button option checked (fakturaktoredane) a part of the email (danedofaktury) is composed. However when I put {danedofaktury} in the email template I just got an "empty" mail

<?php

if ('fakturatak' == 1) {
	
	if ('fakturaktoredane' == 'stare') {
		
		
$form->data['danedofaktury'] = "{$form->data['nazwisko']} {$form->data['imie']}, {$form->data['nazwafirmy']}
{$form->data['kodpocztowy']}, {$form->data['miejscowosc']}, {$form->data['ulica']} {$form->data['nrdomu']} {$form->data['nrlokalu']}";


	} else {
		
$form->data['danedofaktury'] = "{$form->data['fakturanazwafirmy']}
{$form->data['fakturaadres']}
{$form->data['fakturanip']}";

		
	}
	
	
} else {
	
	$form->data['danedofaktury'] = "empty";
	}




?>


Debug info:

[option] => com_chronoforms5
    [chronoform] => e-porada
    [event] => submit
    [imie] => Herpus
    [nazwisko] => McDerpington
    [email] => herp@derp.lol.com
    [telefon] => 555555555
    [nazwafirmy] => 
    [kodpocztowy] => 82-500
    [miejscowosc] => Mokućki Dolne
    [ulica] => Derp
    [nrdomu] => 13
    [nrlokalu] => 
    [tresczapytania] => asd
    [sposobdostarczenia] => email
    [fakturavattak] => 1
    [fakturaktoredane] => stare
    [fakturanazwafirmy] => 
    [fakturaadres] => 
    [fakturanip] => 
    [captcha] => hurfw
    [button22] => Wyślij
    [nadawca] => McDerpington, Herpus.
    [danedofaktury] => empty
    [ip_address] => ::1


Im new to PHP coding so I only know that I set up my custom code wrong. How to fix it, I have no idea though.
GreyHead 10 Sep, 2015
Hi taro8,

Please check your PHP. This check will always fail
if ('fakturatak' == 1) {,
I think that you need
if ( $form->data['fakturatak'] == 1 ) {
and the same in the rest of your code.

Bob
taro8 10 Sep, 2015
Unfortunately with your suggested changes I get " Undefined index" error now, the check still fails.
GreyHead 10 Sep, 2015
Answer
1 Likes
Hi taro8,

Have you checked your code? Did you mean to write fakturavattak instead of fakturatak ??

Bob
taro8 10 Sep, 2015
I had the feeling it was just spelling error. Solved.
This topic is locked and no more replies can be posted.