I have a function in my controller public function org_chart_management()
{ $this->load->dbutil(); $query = $this->db->query("SELECT * FROM employees"); //echo $this->dbutil->csv_from_result($query); //write the string $string2 = $this->dbutil->csv_from_result($query); //write the string $this->load->view('configure_chart.php',$string2); // echo '<script src="/views/configure"></script>'; // echo $string2;
var data = new google.visualization.DataTable(); data.addColumn('string', 'Name'); data.addColumn('string', 'Manager'); data.addColumn('string', 'ToolTip');
// For each orgchart box, provide the name, manager, and tooltip to show. data.addRows([
[{v:'Mike', f:'Mike<div style="color:red; font-style:italic">President</div>'}, '', 'The President'],
[{v:'Jim', f:'Jim<div style="color:red; font-style:italic">Vice President</div>'}, 'Mike', 'VP'],
['Alice', 'Mike', ''],
['Bob', 'Jim', 'Bob Sponge'],
['Carol', 'Bob', '']
]);
// Create the chart. var chart = new google.visualization.OrgChart(document.getElementById('chart_div')); // Draw the chart, setting the allowHtml option to true for the tooltips. chart.draw(data, {allowHtml:true});
}
</script>
</head>
<body>
</body>
<!--Div that will hold the pie chart--> <br><br><br>
<body>
<div id="chart_div"></div>
</body>
</body>
</html>
when I run org_chart_management() I get the following screen. This chart that you see if from hard coded sample data. I really want to pass $string2 to configure_chart.php. I tried doing echo $string2 in the controller, but that just prints the $string2 to the view.Can someone tell me how to get the $string2 into the view?