Form Question - Built-In PHP Processor

Issues related to forms.
Post Reply
bjlolmaugh
 
 
Posts: 162
Joined: Thu Nov 15, 2007 2:36 pm
Contact:

Form Question - Built-In PHP Processor

Post by bjlolmaugh »

I have a question in regards to the resulting email from the Built-In PHP Processor.

The email coming back to me has many of the field in 1 continual line (see Example 1) instead of 1 line per each response (as in Example 2).

How can I get the email results to show as Example 2?

Image


Image
Sincerely,

Barbara Lolmaugh
http://www.websitesbybarbara.com
User avatar
BaconFries
 
 
Posts: 5933
Joined: Thu Aug 16, 2007 7:32 pm

Re: Form Question - Built-In PHP Processor

Post by BaconFries »

This may be of use?
viewtopic.php?f=10&t=64476
User avatar
Pablo
 
Posts: 23401
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form Question - Built-In PHP Processor

Post by Pablo »

Also, note that in the Advanced Form properties there is an option to set the end of line character for messages. The recommended value is 'CRLF'.
bjlolmaugh
 
 
Posts: 162
Joined: Thu Nov 15, 2007 2:36 pm
Contact:

Re: Form Question - Built-In PHP Processor

Post by bjlolmaugh »

BaconFries wrote: Tue Mar 18, 2025 11:23 pm This may be of use?
viewtopic.php?f=10&t=64476
And you all think this is a better solution than my old ways of importing 3rd party generated HTML for my forms and using the DBTS processor?

The solution suggested here is way too much to do.
Sincerely,

Barbara Lolmaugh
http://www.websitesbybarbara.com
User avatar
BaconFries
 
 
Posts: 5933
Joined: Thu Aug 16, 2007 7:32 pm

Re: Form Question - Built-In PHP Processor

Post by BaconFries »

Simple answer yes. Due to what you currently use "FrontPage" (I believe) which was discontinued way back at the end of 2006 and no longer supported. And as you have wrote recently you just updated from Windows 7 to Windows 11 why do this and not stick with a unsupported operating system if it worked. Also note even now you have updated to WWB20 and you still wish to use your 3rd party html with the DBTS processor it wont be supported if it breaks any code generated with WWB20.
bjlolmaugh
 
 
Posts: 162
Joined: Thu Nov 15, 2007 2:36 pm
Contact:

Re: Form Question - Built-In PHP Processor

Post by bjlolmaugh »

BaconFries wrote: Wed Mar 19, 2025 3:12 pm Simple answer yes. Due to what you currently use "FrontPage" (I believe) which was discontinued way back at the end of 2006 and no longer supported. And as you have wrote recently you just updated from Windows 7 to Windows 11 why do this and not stick with a unsupported operating system if it worked.
Because my browser couldn't be updated any longer and I was having difficulty accessing some websites. Honestly, that is the only reason why.
Sincerely,

Barbara Lolmaugh
http://www.websitesbybarbara.com
User avatar
BaconFries
 
 
Posts: 5933
Joined: Thu Aug 16, 2007 7:32 pm

Re: Form Question - Built-In PHP Processor

Post by BaconFries »

Understood and I appreciate that using WWB20 and how you design and layout for your forms etc is the best way forward. You may also get penalised by Google in the future if your site and others you have build aren't RWD compliant so this is another reason to use the likes of Layout Grids in the future. But only you can decide this.
alan_sh
 
 
Posts: 1877
Joined: Tue Jan 01, 2019 5:50 pm

Re: Form Question - Built-In PHP Processor

Post by alan_sh »

Barbara,

If you want to use third party forms, can I recommend Cognitoforms? I use it all the time in my WWB web sites (here's an example) and it's fully RWD compliant.

Cheers

Alan
bjlolmaugh
 
 
Posts: 162
Joined: Thu Nov 15, 2007 2:36 pm
Contact:

Re: Form Question - Built-In PHP Processor

Post by bjlolmaugh »

BaconFries wrote: Tue Mar 18, 2025 11:23 pm This may be of use?
viewtopic.php?f=10&t=64476
Question for you on this.
I am in the process of building a form and I have a section with Check Boxes where the user can check more than one.
How do I set that up in the message formatting so it will display all checked boxes for the same question?
Checkbox #1 has a name of HOUSEHOLD, with a value of BUSY
Checkbox #2 has a name of HOUSEHOLD, with a value of NOISY
Checkbox #3 has a name of HOUSEHOLD, with a value of MODERATE
Sincerely,

Barbara Lolmaugh
http://www.websitesbybarbara.com
User avatar
BaconFries
 
 
Posts: 5933
Joined: Thu Aug 16, 2007 7:32 pm

Re: Form Question - Built-In PHP Processor

Post by BaconFries »

You can apply the use of square brackets [ ] to the name this will then group them together on select by the user.

Code: Select all

<input type="checkbox" name="household[]" value="busy">
<input type="checkbox" name="household[]" value="noisy">
<input type="checkbox" name="household[]" value="moderate">
bjlolmaugh
 
 
Posts: 162
Joined: Thu Nov 15, 2007 2:36 pm
Contact:

Re: Form Question - Built-In PHP Processor

Post by bjlolmaugh »

BaconFries wrote: Thu Apr 03, 2025 1:16 am You can apply the use of square brackets [ ] to the name this will then group them together on select by the user.

Code: Select all

<input type="checkbox" name="household[]" value="busy">
<input type="checkbox" name="household[]" value="noisy">
<input type="checkbox" name="household[]" value="moderate">
Would you mind showing me how to use the brackets in this code formatting?
Name: $name
Email: $email
Website: $website
Sincerely,

Barbara Lolmaugh
http://www.websitesbybarbara.com
User avatar
Pablo
 
Posts: 23401
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form Question - Built-In PHP Processor

Post by Pablo »

I think you will need to give each checkbox a unique name.

Code: Select all

<input type="checkbox" name="check_busy" value="busy">
<input type="checkbox" name="check_noisy" value="noisy">
<input type="checkbox" name="check_moderate" value="moderate">
And then format them like this (for example)
Household: busy=$check_busy, noisy=$check_noisy, moderate=$check_moderate,
bjlolmaugh
 
 
Posts: 162
Joined: Thu Nov 15, 2007 2:36 pm
Contact:

Re: Form Question - Built-In PHP Processor

Post by bjlolmaugh »

Pablo wrote: Thu Apr 03, 2025 5:44 am And then format them like this (for example)
Household: busy=$check_busy, noisy=$check_noisy, moderate=$check_moderate,
Hi Pablo,

I set up each checkbox with a unique name, then followed your example in the mail formatting ... unfortunately it didn't work.
This was the ending results: Household Defined: busy=busy, noisy=$check_noisy, moderate=$check_moderate, quiet=quiet, neighborhoodchildren=$check_neighborhoodchildren, busystreet=busystreet


What else can I try?
Sincerely,

Barbara Lolmaugh
http://www.websitesbybarbara.com
User avatar
Pablo
 
Posts: 23401
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form Question - Built-In PHP Processor

Post by Pablo »

It looks like there is an issue with naming.
Make sure the names match exactly
bjlolmaugh
 
 
Posts: 162
Joined: Thu Nov 15, 2007 2:36 pm
Contact:

Re: Form Question - Built-In PHP Processor

Post by bjlolmaugh »

Pablo wrote: Thu Apr 03, 2025 5:03 pm It looks like there is an issue with naming.
Make sure the names match exactly
Yep, I went through and checked all of that,

The next attempt was adding these fields to the mail forwarding:

Household Defined1: $yes_busy
Household Defined2: $yes_noisy
Household Defined3: $yes_moderate
Household Defined4: $yes_quiet
Household Defined5: $yes_neighborhood_children
Household Defined6: $yes_busystreet


The resulting email was in reverse. The boxes I checked did not reflect an answer, and the boxes I did not check reflected the $field.
I checked off #1 and #4 and those 2 fields are blank.

Household Defined1:
Household Defined2: $yes_noisy
Household Defined3: $yes_moderate
Household Defined4:
Household Defined5: $yes_neighborhood_children
Household Defined6: street
Sincerely,

Barbara Lolmaugh
http://www.websitesbybarbara.com
User avatar
Pablo
 
Posts: 23401
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form Question - Built-In PHP Processor

Post by Pablo »

If you need my help then share a DEMO project.

Please remove everything from the project and page that is not relevant to your question otherwise it will take me a lot of extra to figure out what is wrong.

Image
bjlolmaugh
 
 
Posts: 162
Joined: Thu Nov 15, 2007 2:36 pm
Contact:

Re: Form Question - Built-In PHP Processor

Post by bjlolmaugh »

Sincerely,

Barbara Lolmaugh
http://www.websitesbybarbara.com
User avatar
Pablo
 
Posts: 23401
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form Question - Built-In PHP Processor

Post by Pablo »

I think the problem is that the checkboxes do not have a 'no' value.

This information is from the help: (F1)
Normally, if a checkbox is unchecked then the browser will not send the value to the server.
In WWB, you can also set a value for the ‘OFF’ state. You can set the OFF value, by using two values separated by a pipe-symbol.

For example: ON | OFF.
bjlolmaugh
 
 
Posts: 162
Joined: Thu Nov 15, 2007 2:36 pm
Contact:

Re: Form Question - Built-In PHP Processor

Post by bjlolmaugh »

Pablo wrote: Thu Apr 03, 2025 7:55 pm I think the problem is that the checkboxes do not have a 'no' value.

This information is from the help: (F1)
Normally, if a checkbox is unchecked then the browser will not send the value to the server.
In WWB, you can also set a value for the ‘OFF’ state. You can set the OFF value, by using two values separated by a pipe-symbol.

For example: ON | OFF.
Were you sucessful in testing it?
Does the value have to be the same for all 6 boxes or different?

I just set it up with different values, HOUSEHOLD1, HOUSEHOLD2, etc. and this is the results I got (I checked off Box 1 & Box 5)
Household Defined1: HOUSEHOLD1
Household Defined2: $yes_noisy
Household Defined3: $yes_moderate
Household Defined4: $yes_quiet
Household Defined5: HOUSEHOLD5
Household Defined6: $yes_buzystreet
Sincerely,

Barbara Lolmaugh
http://www.websitesbybarbara.com
bjlolmaugh
 
 
Posts: 162
Joined: Thu Nov 15, 2007 2:36 pm
Contact:

Re: Form Question - Built-In PHP Processor

Post by bjlolmaugh »

I almost have it.
I reversed the value/name.

Checkbox 1 now has a name household1, and a value YES-BUSY HOUSEHOLD.
Changed the other 5 the same way.

Then in the email formatting script:
Household Defined1: $household1
Household Defined2: $household2
Household Defined3: $household3
Household Defined4: $household4
Household Defined5: $household5
Household Defined6: $household6


Now when I get the email it displays this way (I checked off Box 1 & 6):
Household Defined1: YES-BUSY HOUSEHOLD
Household Defined2: $household2
Household Defined3: $household3
Household Defined4: $household4
Household Defined5: $household5
Household Defined6: YES-BUSY STREET


It is giving me the value I am looking for, however, it's still showing a response in the boxes I did not check off.
If there is a way to have no response come through on the unchecked boxes, that would be great. If not, I can live with these results.
Sincerely,

Barbara Lolmaugh
http://www.websitesbybarbara.com
User avatar
Pablo
 
Posts: 23401
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form Question - Built-In PHP Processor

Post by Pablo »

If there is a way to have no response come through on the unchecked boxes, that would be great.
No, there is no option for that. This will a require custom script.
User avatar
BaconFries
 
 
Posts: 5933
Joined: Thu Aug 16, 2007 7:32 pm

Re: Form Question - Built-In PHP Processor

Post by BaconFries »

As Pablos reply this would require a custom solution. You can try the following (untested) by inserting Between the <head></head> tags* in Page HTML. Note you are required to change myForm to the name of your form example Form1

Code: Select all

<script>
document.getElementById('myForm').addEventListener('submit', function(event) {
    const checkboxes = document.querySelectorAll('input[type="checkbox"]');

    checkboxes.forEach(checkbox => {
        if (!checkbox.checked) {
            checkbox.name = ''; // Remove the name, effectively excluding it from the submission.
        }
    });

    // The form will now submit, and unchecked checkboxes will not be included.
});
</script>
What this does in theory is to check or add a listener so if any of the checkboxes are checked or not and onsubmit only sends the those that are will be received
As mentioned it is untested.
bjlolmaugh
 
 
Posts: 162
Joined: Thu Nov 15, 2007 2:36 pm
Contact:

Re: Form Question - Built-In PHP Processor

Post by bjlolmaugh »

BaconFries wrote: Fri Apr 04, 2025 9:21 am As Pablos reply this would require a custom solution. You can try the following (untested) by inserting Between the <head></head> tags* in Page HTML. Note you are required to change myForm to the name of your form example Form1

Code: Select all

<script>
document.getElementById('myForm').addEventListener('submit', function(event) {
    const checkboxes = document.querySelectorAll('input[type="checkbox"]');

    checkboxes.forEach(checkbox => {
        if (!checkbox.checked) {
            checkbox.name = ''; // Remove the name, effectively excluding it from the submission.
        }
    });

    // The form will now submit, and unchecked checkboxes will not be included.
});
</script>
What this does in theory is to check or add a listener so if any of the checkboxes are checked or not and onsubmit only sends the those that are will be received
As mentioned it is untested.

Thank you, however, upon testing it did not make any difference.
Sincerely,

Barbara Lolmaugh
http://www.websitesbybarbara.com
bjlolmaugh
 
 
Posts: 162
Joined: Thu Nov 15, 2007 2:36 pm
Contact:

Re: Form Question - Built-In PHP Processor

Post by bjlolmaugh »

THANK YOU GUYS FOR ALL YOUR HELP.

I was able to get the form completed and I am very satisfied with the end results.

Sorry to be such a pain, but I truly appreciate your assistance.
Sincerely,

Barbara Lolmaugh
http://www.websitesbybarbara.com
User avatar
BaconFries
 
 
Posts: 5933
Joined: Thu Aug 16, 2007 7:32 pm

Re: Form Question - Built-In PHP Processor

Post by BaconFries »

Sorry to be such a pain, but I truly appreciate your assistance.
No need to be sorry thats the purpose of the forum to try and provide help when needed.
Post Reply