Wfb iframe code breaks $_SESSION -...

User 187934 Photo


Senior Advisor
18,728 posts

Here's what's on the session.html.
<?php
session_start();
$_SESSION['email1']="me@you.com";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
This email is being set with <b>$_SESSION['email1']="me@you.com";</b>
<br><br>
<?php echo $_SESSION['email1'];?><br><br>
<a href="index.html">To form with session var</a>
</body>
</html>

Here's the index.html
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<iframe height="358" style="border:none; background:transparent; overflow:hidden; width:100%;"
id="fb_iframe" src="test-session/test-session.html">
</iframe>
<a href="session.html" ><p style="text-align:center;">Back to session var</p></a>
</body>
</html>

The only thing on the test-session.html
This at the top
<?php
session_start();
?>

This in the input.
value="<?php echo $_SESSION["email1"];?>"
<input name="email1" id="item1_email_1" type="email" maxlength="254" placeholder="you@domain.com"
autocomplete="off" data-hint="" 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.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
https://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
https://progrower.coffeecup.com/shop/
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

Thanks Eric,
how do you get the inline form to display without the script? if I remove the script above the iframe code the iframe doesn't load :(

I have created three simple bare bones test pages which you could perhaps try as these pages demonstrate how the code is broken. feel free to run them from the links or copy the code to create your own pages which should allow you to see exactly what is happening. The important thing is knowing how you have loaded the iframe without the preceding code supplied by wfb.
1_ https://bridlington.net/set-session.php which sets the session

<?php session_start();
$_SESSION['send-to']="sendtome@myemail.com" ;
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>set session value</title>
</head>

<body>
This page has simply set a session value for 'send-to' which is echo'd below<br>

<h2><?php echo $_SESSION['send-to']?></h2>
<hr>
<p> now we will link to three different pages <br>

<a href="testpage1.php" target="_blank">testpage1.php</a> which is a simple page invoking the session and outputting the session value<br>
<a href="testpage2.php" target="_blank">testpage2.php</a> which also invokes the session but has the wfb iframe code inserted.
</body>


2) https://bridlington.net/testpage1.php which test the session
<?php
session_start(); ?>
<p>below is the value set in the set-session page :- </p><br>
<h2>" <?php echo $_SESSION['send-to']?> "</h2><br><p> if nothing was displayed between the speech marks then the session has been broken</p>

3) https://bridlington.net/testpage2.php which loads the session and the wfb code to display the iframe with information below the form.
<?php
session_start();

?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<p> below is the value assigned to the send-to variable:-</p><br>
<h2>" <?php echo $_SESSION["send-to"];?>" </h2><br>
<p> a value between the speech mark proves that the variable $_SESSION is working at this stage</p>
<body>
<script type="text/javascript">document.write(unescape("%3Ciframe id=\"fb_iframe\" src=\"test-form.php" + window.location.search + "\" width=\"100%\" height=\"444\"allowtransparency=\"true\" scrolling=\"no\" frameborder=\"0\"%3E&lt;a href=\"test-form.php\" title=\"test-form\"&gt;Check out my CoffeeCup Form&lt;/a&gt;%3C/iframe%3E"));</script>
<noscript>
<iframe height="444" style="border:none; background:transparent; overflow:hidden; width:100%;"
id="fb_iframe" src="test-form/test-form.html">
<a href="test-form.php" title="test-form">Check out my CoffeeCup Form</a>
</iframe>
</noscript>
<p> From these reults it would seem that the session is working however if we now revisit <a href="testpage1.php" target="_blank">testpage1</a> now that the wfb script on this page has been run we will see that there is no longer a session value available.<br> If we return to the <a href="set-session.php" target="_blank">set session page</a> to reset the session you can refresh testpage1 as often as you like and the variable remains working until testpage2 is loaded resulting in the wfb script being run. You will also see that although the session variable shows above, if you refresh this page now that the form has loaded you will see that once again the session has been broken.
</body>
</html>
User 187934 Photo


Senior Advisor
18,728 posts

Working here.
https://ericrohloff.com/coffeecup/ccfor … ession.php
Remove the script that wraps the iframe code.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
https://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
https://progrower.coffeecup.com/shop/
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 am losing any semblance of sanity here, it still wont work at my end without the script, could you post the actual code as you have amended it please as when I remove the script element and leave just the code below the iframe doesnt load within the page it downloads. If I can replicate exactly your code on my server and it still doesn't work I then know to look at my server configuration to resolve the issue. Have you amended any other wfb produced files to make it work for you? Is the form you load (test-session.html) as produced by wfb or are there amendments to that?

Once again I really appreciate your help with this.
<body>
<iframe height="444" style="border:none; background:transparent; overflow:hidden; width:100%;"
id="fb_iframe" src="test-form/test-form.html">
</iframe>
</body>
User 187934 Photo


Senior Advisor
18,728 posts

The only thing I did to my form.html was add the session start to the top. Make sure there's no other output before the session_start();
<?php
session_start();
?>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
https://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
https://progrower.coffeecup.com/shop/
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,
that is set, there must be something different in your code, if I use the same iframe code to load a different page the iframe loads but it wont load /test-form/test-form.html it just downloads it. I am sure that if you post your actual page code or even zip up the form folder and the two root folder files that you say are working and attach them to a post I will be able to resolve the problem quite quickly. I could at least then import your files directly onto my server and test the result. At that stage the only difference would be the hosting so if your version doesn't work on my server I can at least stop wasting hours and hours at the code end and take the matter up with the hosting company.

Thanks in advance


User 187934 Photo


Senior Advisor
18,728 posts

Do you get an error.log on your server within the form directory?
Have you tried removing that cookie check script from the testpage2.php?
Is your host setup to parse php within html? if not change the test-form.html to test-form.php and adjust your iframe src or edit your .htaccess to parse php within html.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
https://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
https://progrower.coffeecup.com/shop/
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,
1) There are no errors in the error log relating to the page load etc
2) have removed the cookie check from testpage2 no change
3) host is set up to parse php code within html files

Is there any way at all that you would be prepared to zip up your files and folders for me to analyse and try on my server?
User 187934 Photo


Senior Advisor
18,728 posts

Here ya go,
https://ericrohloff.com/coffeecup/ccfor … ession.zip
Did you try changing the test-form.html to test-form.php?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
https://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
https://progrower.coffeecup.com/shop/
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

Thanks Eric,
I will look through the files over the weekend, I have previously tried renaming the html file to php but for some reason it still tried to load the html version, may have been a cache issue not sure. My head is spinning at the moment but hopefully your files will help resolve the issue.

Will keep you informed as to how I get on.

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.