I want to send the content of a $_SESSION to a php page linked by a Javascript script:
the code I'm working with is:
<?php
error_reporting(0);
session_start();
include("connect.php");
$query="SELECT id,name... FROM users WHERE ...";
$result= mysql_query($query) or die ($query);
while($row=mysql_fetch_array($result))
{
...
$_SESSION['user_id']=$row[mysql_field_name($result,3)];
...
}
echo
"
<div id='chartdiv' style='width: 100%; height: 500px;'></div>
<script>
var chart = AmCharts.makeChart( 'chartdiv',
{
'type': 'serial',
'dataLoader':
{
'url': 'dataLastSevenDays.php'
},
'pathToImages': 'http://www.amcharts.com/lib/images/',
'categoryField': 'category',
'dataDateFormat': 'YYYY-MM-DD',
'startDuration': 1,
'categoryAxis':
{
'parseDates': true
},
'graphs':
[
{'valueField': 'value1','bullet': 'round','bulletBorderColor': '#FFFFFF','bulletBorderThickness': 2,'lineThickness ': 2,'lineAlpha': 0.5},
]
} );
</script>
";
Now, I want to send the content of $_SESSION['user_id'] to the "dataLastSevenDays.php" page (which is actually contained in the JS script), but I can't figure out how it can be done.
I need to send the content of $_SESSION['user_id'] to that page because it actually contains the Query that draws the chart