Wfb iframe code breaks $_SESSION -...

User 187934 Photo


Senior Advisor
20,181 posts

Remember to change the iframe src also to reflect the name change to test-form.php
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2794810 Photo


Registered User
24 posts

Hi Eric,
our hosting company have just advised that there was an error in the servers .htaccess file which has now been rectified so I can confirm that all those stupid things that just didn't make sense no longer exist. We would probably never have got to the bottom of it without your providing the test files you had created so thanks for that.

The position now is that we are almost there.
I can get the session variable to populate the form using the following;
<input name="email_address2" id="item14_text_1" type="text" maxlength="254"
placeholder="" value="<?php echo $_SESSION['send-to'];?>" autocomplete="off" data-hint="" />

Unfortunately there is still an issue somewhere, in form.cfg.php I have added the code below to display at the bottom of the confirm page and in that area the variable value once again does not display.
<p>Your form was successfully submitted to <?php echo $_SESSION['send-to'];?></p>


At the head of form.cfg.php I have;
<?php session_start(); ?>
<?php exit(0); ?>

so the session is being started although I dont know what effect the second line exit(0) may be having on things.
When the form is submitted the person filling in the form gets their email response but an email is not sent to the email value in the session variable. I have tried coding that section in two ways
"from" : "booking-enquiries@bridlington.net",
"is_present" : true,
"replyto" : "[email]",
"to" : "[email_address2]"
which is the form variable that we echoed the session variable into
and also
"from" : "booking-enquiries@bridlington.net",
"is_present" : true,
"replyto" : "[email]",
"to" : "<?php echo $_SESSION['send-to'];?>"
which is the session variable itself

neither of which work for me.

The strange thing is that the email the form filler receives does include the value of the session variable within the "your enquiry was sent to.." section.

In case I havent been clear, I want the notification email to be sent to the value in the session variable. I believe it should work logically but perhaps there is another file somewhere that needs the session start code adding or maybe its bad syntax.

I appreciate the invaluable help you have given so far and understand if you have had more than enough of this problem but any help you can provide to get me over this last hurdle would be appreciated.

I have uploaded a zip copy of the files used which you can download from the link below in case it helps, you would just need to create a page to set an initial session variable https://www.bridlington.net/eric.zip

Thanks again for all your help.

Steve
User 187934 Photo


Senior Advisor
20,181 posts

On line 193 of the datasavemailer.cls.php you'll see this.
$to = $this->_SubstituteAddress( $cfg_spec->to );

put your SESSION var just below that.
$to = $_SESSION['send-to'];


I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2794810 Photo


Registered User
24 posts

Hi Eric,
When added the code is replacing the wrong email address, as you know, two emails are sent a) the auto response goes to the person filling out the form and b) the notification goes to the person set to receive the enquiry.

The instructions you supplied replaces the value of "A" whereas we need the session variable to replace the value of "B"

Is there a similar file which deals with the notification email?
User 2794810 Photo


Registered User
24 posts

Hi Eric,
have been playing around with this and found that with your code inserted both emails are going out but both are going to the session value so it looks as though that line replaces the "to" value for both the notification and the automatic response emails.
User 187934 Photo


Senior Advisor
20,181 posts

Ok I found the issue. The formbuilder uses a loop to send the To: emails.
Within the Form Builder App for the To: input on the Notifications tab enter a fake email address.
I used test@test.com
Now at the same spot below line 193 I put this.
if($to == "test@test.com"){
$to = $_SESSION['send-to'];
}
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2794810 Photo


Registered User
24 posts

Eric you deserve a medal. Everything now works and there is no way that I would have resolved this without your help.

Once again Eric thanks for all your help with this. I have a couple of issues still to resolve relating to the formatting of the form but hopefully I can resolve them with a bit of experimentation.

Steve

User 187934 Photo


Senior Advisor
20,181 posts

Sorry for the extra quote mark. Sticky key.:lol: Let me know if you need anymore assistance.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.