Wfb iframe code breaks $_SESSION -...

User 2794810 Photo


Registered User
24 posts

Hi all,
I am trying to pass a variable containing the recipients email address from my dynamic source page to either the form.html pulled into the iframe or into form.cfg.php using $_SESSION.

I can get the passing of the value to work fine to a simple test page until I insert the wfb iframe code into my source page at which time the session element stops working. All the wfb code is stock so I cannot understand why it breaks the session element. Unfortunately I am not in the office at present so cannot post the code but was wondering if anyone else had encountered this issue and if so how they fixed it.

Thanks in advance for any help provided.
User 187934 Photo


Senior Advisor
20,181 posts
Online Now

Hi Steve,
Did you put
session_start();
at the top of your form page?
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,
The transfer of the variables seems to work fine until the following code is inserted, then it breaks. Is there any element of the code below that I can remove without it affecting how the form works to try to narrow down the cause of the issue further?

<noscript>
<iframe height="1158" style="border:none; background:transparent; overflow:hidden; width:100%;"
id="fb_iframe" src="/availability-request/availability-request.html">
<a href="availability-request.php" title="availability-request">Check out my CoffeeCup Form</a>
</iframe>
</noscript>
User 2794810 Photo


Registered User
24 posts

Sorry posted the wrong code. it is the code below which breaks the session, I am going to try adding session_start(); to different pages used in the form to see if that makes any difference but any advice on how I can minimise the code below to try to get to the bottom of things would be helpful.

<script type="text/javascript">document.write(unescape("%3Ciframe id=\"fb_iframe\" src=\"availability-request.php" + window.location.search + "\" width=\"100%\" height=\"1158\"allowtransparency=\"true\" scrolling=\"no\" frameborder=\"0\"%3E&lt;a href=\"availability-request.php\" title=\"availability-request\"&gt;Check out my CoffeeCup Form&lt;/a&gt;%3C/iframe%3E"));</script>
User 187934 Photo


Senior Advisor
20,181 posts
Online Now

Try removing the script from the iframe code.
<iframe height="1158" style="border:none; background:transparent; overflow:hidden; width:100%;"
id="fb_iframe" src="/availability-request/availability-request.html">
</iframe>
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,
I have tried that and it doesn't make any difference, without doubt it is something in the code
<script type="text/javascript">document.write(unescape("%3Ciframe id=\"fb_iframe\" src=\"availability-request.php" + window.location.search + "\" width=\"100%\" height=\"1182\"allowtransparency=\"true\" scrolling=\"no\" frameborder=\"0\"%3E&lt;a href=\"availability-request.php\" title=\"availability-request\"&gt;Check out my CoffeeCup Form&lt;/a&gt;%3C/iframe%3E"));</script>
that is breaking the Session.
To provide more info, the page that the form is called into is populated dynamically from sql database. as a result of this the form when completed needs to be sent to the email address associated with the record loaded into the host page. on the host page this variable is
($advertisersRecord['email_address'])

I have created a session element using the following
<?php
session_start();
$_SESSION['email_address2']:($advertisersRecord['email_address']) ;
?>


To check that the session is working I have created a test page with the following code

<?php
session_start();
echo $_SESSION['email_address2'];

?>

when run the test page displays the correct email address so I know that at that point the session variable is being stored and can be retrieved.

However as soon as I add the wfb produced iframe code shown at the top of this post the test page no longer displays the email variable value. I deduce from that that something in that code is breaking the session.

The idea is to be able to tx the value to form.cfg.php to replace the static "To" value with the variable. To this end I have added
<?php

session_start();
[email_address2]=$_SESSION[email_address2]
?>

to the top of form.cfg.php and changed the notification message section to the code below however I cannot test if that approach will work until I can resolve this issue with why wfb's code breaks the session or find an alternative way of getting the variable value into form.cfg.php securely.

I have been trying to get this to work now for over a week trying different methods but the fact that I am not a programmer doesn't help. Any help anyone can give at this stage would be extremely welcome.

"key" : "Bridlington Advertiser Enquiry Notification",
"subject" : "Somebody filled out your form!"
},
"from" : "booking-enquiries@bridlington.net",
"is_present" : true,
"replyto" : "[email]",
"to" : "[email_address2]"



User 187934 Photo


Senior Advisor
20,181 posts
Online Now

Did you put the $_SESSION start code on your iframe page and your form html pge?
<?php
session_start();
?>


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,
Yes, as mentioned the session element works until we insert the wfb code, not only does form.html not pick up the session variable but the additional test page can no longer pick it up so the script either stops the session being set or removes it from the server. I assume that somewhere in the script there is some sort of clear or reset routine but I dont have the technical expertise to diagnose it. Would a second session started within the wfb scripts potentially cause the problem? If so, do we know if that happens anywhere?

I have thought of trying post and get and set the value in the url but am not sure where to add the code as the inline frame refers to two different pages, the html page and the php page.

Given the code I have included above how would you code a post and get routine?
User 187934 Photo


Senior Advisor
20,181 posts
Online Now

It seems to work for me here.
https://ericrohloff.com/coffeecup/ccfor … ssion.html
I'm setting the $_SESSION variable with a string.
I'm echoing the value in the form input with
value="<?php echo $_SESSION["email1"];?>"
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,
could you post the files that you have used for your example as I am totally confused as
a) session.html doesnt seem to be setting the session variable
b) index.html doesn't include the wfb script which I advise is breaking the session
c) I cannot see where you are calling the session value into test-session.html
d) the code in test-session.html doesn't look as though the email address is being set by the variable
<input name="email1" id="item1_email_1" type="email" maxlength="254" placeholder="you@domain.com"
autocomplete="off" data-hint="" value="me@you.com" />


As mentioned I am not a programmer so access to the coding etc you have used to produce a working version would be most helpful as the coding you have bears little resemblance that produced for me by wfb.

Thanks agin.

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.