有關使用 open flash chart 傳送post變數的問題
先從 sex.php 得到男女的數量 再用表單傳隱藏欄位到sexchart.php
<?php
mysql_connect("127.0.0.1", "root", "1111");
mysql_select_db("dbproject2");
$f="SELECT count(*)
FROM customer c, purchase_info o, product p
WHERE p.id = o.p_id
AND o.c_number = c.c_number AND p.id= ". $_GET["product"] ." AND c.sex='f'";
$m="SELECT count(*)
FROM customer c, purchase_info o, product p
WHERE p.id = o.p_id
AND o.c_number = c.c_number AND p.id= ".$_GET["product"]." AND c.sex='m'";
$fq= mysql_fetch_array(mysql_query($f));
$mq= mysql_fetch_array(mysql_query($m));
$v1=$fq[0] ;
$v2=$mq[0];
echo $v1."<br>";
echo $v2;
?>
<form action="sexchart.php" method="post">
<input name="valuef" type="hidden" value="<?php echo $v1;?>" />
<input name="valuem" type="hidden" value="<?php echo $v2;?>" />
<input name="" type="submit" value="submit" />
</form>
sexchart.php
<?php
include 'php-ofc-library/open-flash-chart.php';
$title = new title( '顧客性別分析' );
$pie = new pie();
$d = array(
new pie_value($_POST['valuef'], "female"),
new pie_value($_POST['valuem'], "male"),
);
$pie->set_alpha(0.6);
$pie->set_start_angle( 35 );
$pie->add_animation( new pie_fade() );
$pie->set_tooltip( '#val# of #total#<br>#percent# of 100%' );
$pie->set_colours( array('#1C9E05','#FF368D') );
$pie->values( $d );
$chart = new open_flash_chart();
$chart->set_title( $title );
$chart->add_element( $pie );
$chart->x_axis = null;
echo $chart->toPrettyString();?>
<a href="chart-3.php?ofc=sexchart.php" >SEE the PIE!</a>
由此開啟圖表 引進sexchart.php
chart3.php
<html>
<head>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("open-flash-chart.swf", "my_chart", "500", "500", "9.0.0");
</script>
</head>
<body>
<p>Hello World</p>
<div id="my_chart"></div>
</body>
</html>
我echo出來的數字都正確
但我不知道為什麼放到圖表裡就是不行...
PLEASE HELP ME!!!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.119.233.192
PHP 近期熱門文章
PTT數位生活區 即時熱門文章