nurul_1 0 Newbie Poster

Hi all,please help me. I want to create bar graph in my system. But I have problems. user can pick date from datetime picker and the graph should appear. But the graph not appear. This is my code.

<?php include("dbase.php"); ?>
<?php 

$dateCollect = $_GET['dateCollect'];

$show = "SELECT count(mailCategory) As mailCategory FROM mail WHERE mailCategory = 'Pos Express' AND dateCollect = '".$dateCollect."'";
$result = mysql_query($show);
$row = mysql_fetch_array($result);

$show2 = "SELECT count(mailCategory) As mailCategory FROM mail WHERE mailCategory = 'Pos Biasa' AND dateCollect = '".$dateCollect."'";
$result2 = mysql_query($show2);
$row2 = mysql_fetch_array($result2);

$show3 = "SELECT count(mailCategory) As mailCategory FROM mail WHERE mailCategory = 'Pos Laju' AND dateCollect = '".$dateCollect."'";
$result3 = mysql_query($show3);
$row3 = mysql_fetch_array($result3);

$show4 = "SELECT count(mailCategory) As mailCategory FROM mail WHERE mailCategory = 'DHL' AND dateCollect = '".$dateCollect."'";
$result4 = mysql_query($show4);
$row4 = mysql_fetch_array($result4);

$show5 = "SELECT count(mailCategory) As mailCategory FROM mail WHERE mailCategory = 'SkyNet' AND dateCollect = '".$dateCollect."'";
$result5 = mysql_query($show5);
$row5 = mysql_fetch_array($result5);

$show6 = "SELECT count(mailCategory) As mailCategory FROM mail WHERE mailCategory = 'City-Link' AND dateCollect = '".$dateCollect."'";
$result6 = mysql_query($show6);
$row6 = mysql_fetch_array($result6);

$show7 = "SELECT count(mailCategory) As mailCategory FROM mail WHERE mailCategory = 'Nationwide' AND dateCollect = '".$dateCollect."'";
$result7 = mysql_query($show7);
$row7 = mysql_fetch_array($result7);

?>





<script>

            function graph(e)
            {


        var service1 = <?php echo $row['mailCategory'];?>;
        var service11 = "Pos Express";
        var service2 = <?php echo $row2['mailCategory'];?>;
        var service22 = "Pos Biasa";
        var service3 = <?php echo $row3['mailCategory'];?>;
        var service33 = "Pos Laju";
        var service4 = <?php echo $row4['mailCategory'];?>;
        var service44 = "DHL";

        var service5 = <?php echo $row5['mailCategory'];?>;
        var service55 = "SkyNet";
        var service6 = <?php echo $row6['mailCategory'];?>;
        var service66 = "City-Link";
        var service7 = <?php echo $row7['mailCategory'];?>;
        var service77 = "Nationwide";



                    var hbar = new RGraph.HBar('cvs', [service1,service2,service3,service4,service5,service6,service7]);
                    hbar.Set('chart.units.pre', '');
                    hbar.Set('chart.units.post', '');
                hbar.Set('chart.colors', ['#2E64FE']);
                    hbar.Set('chart.strokestyle', 'rgba(0,0,0,0)');
                    hbar.Set('chart.labels.above', true);
                    hbar.Set('chart.labels.above', true);
                    hbar.Set('chart.vmargin', 15);
                    hbar.Set('chart.background.grid', false);
                    hbar.Set('chart.labels', [service11,service22,service33,service44,service55,service66,service77]);

                if (!RGraph.isOld()) {
                        hbar.Set('chart.tooltips', [service11,service22,service33,service44,service55,service66,service77]);
                    }

                    hbar.Set('chart.labels.above.decimals', 0);
                    hbar.Set('chart.xlabels', false);
                    hbar.Set('chart.gutter.left', 250);
                    hbar.Set('chart.gutter.right', 50);
                    hbar.Set('chart.gutter.top', 25);

                    hbar.Set('chart.noxaxis', true);
                    hbar.Set('chart.noxtickmarks', true);
                    hbar.Set('chart.noytickmarks', true);
                    RGraph.isOld() ? hbar.Draw() : RGraph.Effects.HBar.Grow(hbar);


                }
    </script>







<form name="form1" method="post" action="">
        <p>
          <label>
            <input type="text" name="dateCollect" id="dateCollect" >
            <a href="calendar.php"><img src="image/iconCalendar.gif" name="cmdCal" value="Launch Calendar" onClick='javascript:window.open("calendar.php?form=form1&field=dateCollect","","top=50,left=400,width=175,height=140,menubar=no,toolbar=no,scrollbars=no,resizable=no,status=no"); return false;' border="0" ></a></label>
          <label>
            <input type="submit" name="Go" id="Go" value="Go" onClick="graph(this.value);"  >
          </label>
        </p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>
                <div id="chart_div"><canvas id="cvs" width="600" height="650" style="border: 1px solid gray ">[No canvas support]</canvas></div>
      </p>
      </form>

Please help me. Thank you in advanced