Stuck for months.... Passing values from .php to Storyline
Oct 13, 2015
Hi, we managed to return values from an ID number entered by learner in storyline course from our msql dbase. The values returned from the dbase is correct in the .php.
We are now stuck on how we can set the variables in storyline with the values in the .php file. How can we pass this values into storyline and set the variables within storyline?
So far if we push it to the URL is only adds these values on the URL (address) and not the variables within storyline.
Below is the .php code with the values.
<?php
$IDNum = @ $_GET['idvalue'];
//var_dump ($IDNum);
$connect = new mysqli("192.168.0.1", "root", "", "GTSSchool");
$sql = "SELECT l.na_id_number AS na_id_number, l.first_name AS firstname, l.last_name AS lastname, tc.testing_centre_name AS testingcenter FROM learners l, testing_centres tc WHERE l.testing_centre_id = tc.id AND na_id_number='$IDNum';";
$rec = $connect->query($sql);
if(!$rec || !$rec->num_rows)
{
echo "No data";
}else
{
while($row = $rec->fetch_array())
{
$idvalue = $row['na_id_number'];
$firstname = $row['firstname'];
$lastname = $row['lastname'];
$testingcenter = $row['testingcenter'];
}
header("Location: http://localhost/CLLT/story.html?firstname=$firstname&lastname=$lastname&testingcenter=$testingcenter&idvalue=$idvalue");
}
?>
3 Replies
You're going to need to use some javascript code within your Storyline course to retrieve the values of the url variables, and then set the values of corresponding Storyline variables that you have defined. Perhaps someone can post an example.
Could you save the variables to a cookie and use an execute javascript trigger to grab those cookie values?
I don't really know much about how to use php, so there is probably a better way to send variables to storyline with php.
Hi Kennethg!
Not my realm of expertise for sure, but looks like you have some community members popping in to try and assist.
This discussion is closed. You can start a new discussion or contact Articulate Support.