Form recipient template doesn't accept [PHP] code

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
User avatar
axelko
Posts: 138
Joined: Mon 27. Feb 2006, 22:51
Contact:

Form recipient template doesn't accept [PHP] code

Post 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
-------------------------------
User avatar
juergen
Moderator
Posts: 4556
Joined: Mon 10. Jan 2005, 18:10
Location: Weinheim
Contact:

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

Post by juergen »

not 4 shure but why not trying <?php .... ?> there ? Untested !
User avatar
axelko
Posts: 138
Joined: Mon 27. Feb 2006, 22:51
Contact:

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

Post by axelko »

Hi DF6IH ,

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

Greetz,

Axel
-------------------------------
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

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

Post 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:
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

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

Post 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?
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

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

Post 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...
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
axelko
Posts: 138
Joined: Mon 27. Feb 2006, 22:51
Contact:

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

Post 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
-------------------------------
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

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

Post 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.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
axelko
Posts: 138
Joined: Mon 27. Feb 2006, 22:51
Contact:

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

Post 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
-------------------------------
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

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

Post 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
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
axelko
Posts: 138
Joined: Mon 27. Feb 2006, 22:51
Contact:

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

Post 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
-------------------------------
Post Reply