Page 1 of 1

Form recipient template doesn't accept [PHP] code

Posted: Mon 20. Oct 2008, 17:23
by axelko
Hi,

I have an order form with check boxes based on the form-CP. I've made a custom form template. Also I made a custom 'on succes' html template. In the on succes template the form is displayed and for the selected check boxes is a [x] displayed.

Code: Select all

[x] choice1
[ ] choice2
[ ] choice3
[x] choice4
For this I used some simple php code.

Code: Select all

[PHP]if(in_array(Choice1,$_POST['opties'])) echo '[x] Choice1 <br />'; 
else echo '[&nbsp;&nbsp;] Choice1'[/PHP]
This all works fine. Only when I use the [PHP] code [/PHP] in the recipient template the code isn't rendert and in the email that is received the [PHP] code [/PHP] is shown.
Does anyone know a solution for this?

Greetz,

Axel

Re: Form recipient template doesn't accept [PHP] code

Posted: Mon 20. Oct 2008, 18:24
by juergen
not 4 shure but why not trying <?php .... ?> there ? Untested !

Re: Form recipient template doesn't accept [PHP] code

Posted: Mon 20. Oct 2008, 19:23
by axelko
Hi DF6IH ,

Already tried, no succes. Al the code between <php ...?> is ignored. But thanx for the suggestion.

Greetz,

Axel

Re: Form recipient template doesn't accept [PHP] code

Posted: Mon 20. Oct 2008, 20:38
by Jensensen
Hi axelko,

right you are. Actually I've tested the following scheme:

Code: Select all

[PHP]
code
[/PHP]
works perfect with form fields like:
--> template (custom alignment of form fields)
--> on success
--> on error


BUT NOT WITH the form field: recipient - template

May be, that, when sending the mail - really late / afterwards - the variables have gone or aren't available anymore!¿

For forms sometimes it is a good idea to use FE init.... in combination with FE renderer...¿¿¿
Anyway, it needs some deeper code checking (core, hack)...

Dive in and please let us know.... :wink:

Re: Form recipient template doesn't accept [PHP] code

Posted: Mon 20. Oct 2008, 20:47
by update
Why would you like to do so? All checked boxes with their related labels are shown within the mail body while all unchecked are not. This is a sufficient procedure, isn't it?

Re: Form recipient template doesn't accept [PHP] code

Posted: Mon 20. Oct 2008, 20:59
by Jensensen
claus wrote:Why would you like to do so?...
That's right, too. So, axelko, please enlighten - what are the reasons why you need PHP with the recipient/when sending mails...

Re: Form recipient template doesn't accept [PHP] code

Posted: Mon 20. Oct 2008, 23:15
by axelko
I'm trying to simulate a existing analog orderform for a small company that makes curtains (almost by hand). They want that their customers can fill this form in online, insted of faxing. But they and the customers aren't very handy with computers and it would be nice if the online form looks exactly like the analog form.
Also if the form comes in by email they just want to print this and stick this to the curtains so they know how things should be sewed together.

This is a very small project and I thought I can do this with the form-CP. And almost all works except the last step, emailing the form so that they have a nice list with option they should do with the curtains.

Hope this explains a bit.

Greetz,

Axel

Re: Form recipient template doesn't accept [PHP] code

Posted: Tue 21. Oct 2008, 00:01
by Jensensen
"analog form" vs online form (view) should be no problem by using css.

as claus mentioned yet (and OG noticed some time ago) there should be no problem anymore even with the results of check boxes.
need some more testing...

ever tried sending HTML emails to the recipient? in this case perhaps the incoming mail could have {nearly} the same look as the printed, "analog" questionnaires.

Re: Form recipient template doesn't accept [PHP] code

Posted: Wed 22. Oct 2008, 00:28
by axelko
Hi,
Already tried this all with css, actually that's how the custom template is build. Also now use inline styles and tables insted of divs for the email (like <td style="border: #1f3991 1px solid; padding: 5px;>) because the internal css styles (like <style type="text/css">td {border: #1f3991 1px solid;} </style>) are ignored.
Also how can I show al checkboxes in the email nice formatted, the output for i.e. {options} is just comma separated. But I'll just try some more testing and hopefully I'll find a workaround.
Thanx for thinking with me.

Greetz,

Axel

Re: Form recipient template doesn't accept [PHP] code

Posted: Wed 22. Oct 2008, 07:21
by Jensensen
So, you want the outgoing mail to look like a form? This is difficult because there is no rendering of form input fields at this moment anymore but only the results are processed. The information of input fields has gone.

I'm afraid that it needs some hack, to get a nice formatted email regarding the results of check boxes OR another issue: http://code.google.com/p/phpwcms/issues/list

Re: Form recipient template doesn't accept [PHP] code

Posted: Wed 5. Nov 2008, 09:44
by axelko
Hi,

I made an issue out of this (http://code.google.com/p/phpwcms/issues ... &start=100) and the answer is clear and short:

Recipient template is not rendering PHP inline and it was never planned to so.

Greetz,

Axel