การนำาค่าใน ตัวแปร $_SESSION ใส่ใน function JavaScipt
Code (PHP)
<?php
session_start();
echo $_SESSION['idcard1'] ;
echo $_SESSION['idcard2'] ;
echo $_SESSION['idcard3'] ;
echo $_SESSION['idcard4'] ;
echo $_SESSION['idcard5'] ;
echo $_SESSION['idcard6'] ;
echo $_SESSION['idcard7'] ;
?>
<html>
<head>
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {packages:['orgchart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
var idcard1 = "1";
var idcard2 = "2";
var idcard3 = "3";
var idcard4 = "4";
var idcard5 = "5";
var idcard6 = "6";
var idcard7 = "7";
data.addColumn('string', 'Name');
data.addColumn('string', 'Manager');
data.addColumn('string', 'ToolTip');
data.addRows([
//[{v:idcard1, f:'Mike<div style="color:red; font-style:italic">President</div>'}, '', 'The President'],
// [{v:idcard2, f:'Jim<div style="color:red; font-style:italic">Vice President</div>'}, idcard1, 'VP'],
[idcard1, '', ''],
[idcard2, idcard1, ''],
[idcard3, idcard1, ''],
[idcard4, idcard2, 'idcard4'],
[idcard5, idcard2, ''],
[idcard6, idcard3, ''],
[idcard7, idcard3, '']
]);
var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
chart.draw(data, {allowHtml:true});
}
</script>
</head>
<body>
<div id='chart_div'></div>
</body>
</html>
ผมลองใช้คำสั่งตามนี้ครับมันไม่รับค่า ขึ้นหน้าขาว ว่างๆ ครับ ต้องใส่ยังไงครับ
Code
var idcard1 = <?=$_SESSION['idcard1']?>;
var idcard2 = <?=$_SESSION['idcard2']?>;
var idcard3 = <?=$_SESSION['idcard3']?>;
var idcard4 = <?=$_SESSION['idcard4']?>;
var idcard5 = <?=$_SESSION['idcard5']?>;
var idcard6 = <?=$_SESSION['idcard6']?>;
var idcard7 = <?=$_SESSION['idcard7']?>;
Tag : PHP, Ms SQL Server 2005
Date :
2013-07-23 21:50:32
By :
mr_tasana
View :
686
Reply :
2
รูปนี้ครับ รีบไปหน่อย
Date :
2013-07-23 21:53:47
By :
mr_tasana
ได้ลองตรวจที่ view source แล้ว???
Date :
2013-07-24 06:06:36
By :
watcharop
Load balance : Server 04