0

I'm making a digital escape room for English learners using thinglink.com and google forms as part of my Masters dissertation and I need the students to complete the google form with the correct answers/codes before they can go to the next 'room' or scene. This is proving difficult, as the form opens in a small inset window on the thinglink application, so when I put the link to the next scene on the final success page that the students only see after completing the form correctly, the link opens in the same small window the form is in, rather than a new window or tab.

I can't put a target"_blank" in the link, as you write it as text, not html on google forms, and it parses automatically, so I thought I could get round it using php and javascript window.open()

There are 4 different scenes showing environmental issues in the Canary Islands, so I wrote a small page I can host on my server that will redirect to a scene based on the parameters.

an example link would be: http://proyectoclil.islaidiomas.com/thinglink.php?t=2&p=yes

It's not working for me... and I'm not sure why. I'm getting a HTTP ERROR 500.

The thinglink scene that is number 2 is this one: https://www.thinglink.com/video/1383584341203877890

The google forms open on the arrow icon. The answers to the questions, if you want to see what happens and therefore what my problem is without doing all the activities, are: 1a. Fossil Fuels, 1b. 50-100 years, 2. compost, 3. biodegradable, 4. 343615. (words in lowercase)

Here is my code :

<?php

$_GET[$t];

if ($t='2') {$m='1383584341203877890';} // Granadilla
elseif ($t='3') {$m='1384238142592122882';} // Los Gigantes
elseif ($t='4') {$m='1384298132874985474';} // Teide
else ($m='1383032295832682498'); // Vilaflor
  
$thinglink = 'https://www.thinglink.com/mediacard/' . $m . '?p=yes';

?>

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Thinglink Escape Room</title>

<?php

if( isset($_GET['p']) {
echo 'window.open("' . $thinglink . '")';
}
   
?>
</head>

<body>
This page should redirect you. Please <a href="<?php echo $thinglink; ?>" target="_blank">CLICK HERE</a> if it doesn't.
</body>
</html>

Thanks in advance for any help!

Kirsty

Kirsty Jay
  • 39
  • 5

1 Answers1

0

The script has some errors

Parse error: syntax error, unexpected '{' on line 22

PHP error display should be enabled during development, see How do I get PHP errors to display?

The variable t can be set like this $t = $_GET["t"].

The window.open call should be surrounded by <script> tag in order to be executed as JavaScript.

<script><?php echo "window.open('$thinglink')"; ?></script>

However, this functions opens a popup window. Many browser block popups. I suggest using <meta http-equiv="Refresh", see https://www.w3docs.com/snippets/html/how-to-redirect-a-web-page-in-html.html

A working suggestion:

<?php

$t = $_GET["t"];

if ($t='2') {$m='1383584341203877890';} // Granadilla
elseif ($t='3') {$m='1384238142592122882';} // Los Gigantes
elseif ($t='4') {$m='1384298132874985474';} // Teide
else ($m='1383032295832682498'); // Vilaflor

$thinglink = 'https://www.thinglink.com/mediacard/' . $m . '?p=yes';

?>

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Thinglink Escape Room</title>



<?php if (isset($_GET['p'])) {?>
    <meta http-equiv="Refresh" content="0; url='<?php echo $thinglink; ?>'" />
<?php } ?>


</head>

<body>
This page should redirect you. Please <a href="<?php echo $thinglink; ?>" target="_blank">CLICK HERE</a> if it doesn't.
</body>
</html>
scito
  • 26
  • 6