Php 过滤图形
我有一个5条的图表。现在我想过滤这个图。我用“年龄”和“性别” 但是当我尝试过滤它时,我丢失了很多数据。例如,在使用过滤器之前,我在第一个栏中得到了500点。使用性别过滤器后,我男性得300分,女性得50分。。 我不知道为什么 我在另一个.php文件中使用会话ID,在那里我从我的sql db获得了数据Php 过滤图形,php,session,session-variables,Php,Session,Session Variables,我有一个5条的图表。现在我想过滤这个图。我用“年龄”和“性别” 但是当我尝试过滤它时,我丢失了很多数据。例如,在使用过滤器之前,我在第一个栏中得到了500点。使用性别过滤器后,我男性得300分,女性得50分。。 我不知道为什么 我在另一个.php文件中使用会话ID,在那里我从我的sql db获得了数据 <form method="post"> <p> <b>Filter&l
<form method="post">
<p>
<b>Filter</b>:
</p>
<p>
<b>Sex</b>: <input type="radio" name="sex" value="m"
id="check6"> Male <input type="radio"
name="sex" value="w" id="check7"> Female
<input type="radio" name="sex"
value="all" id="sexALL" checked> All
</p>
<p>
<b>Age</b>: <input type="radio" name="age" value="U18"
id="check1"> - 18 <input type="radio"
name="age" value="1827" id="check2"> 18-27 <input
type="radio" name="age" value="2840" id="check3">
28-40 <input type="radio" name="age"
value="4155" id="check4"> 41-55 <input
type="radio" name="age" value="55U" id="check5"> über
55 <input type="radio" name="age" value="all"
id="ageALL" checked> All
</p>
<div style="margin-left: 900px; margin-top: -37px">
<button class="btn btn-primary" input type="submit"
value="filterbtn" name="filterbtn">
<font color="WHITE">OK</font>
</button>
</div>
</p>
</form>
<?php
if (isset($_POST['filterbtn'])) {
{
if ($_POST['sex']== 'all') {
$Sex = "IN ('1', '2', '0')";
$_SESSION['sex'] = $Sex;
} else if ($_POST['sex'] == 'm') {
$Sex = "IN ('1') ";
$_SESSION['sex'] = $Sex;
} else if ($_POST['sex'] == 'f') {
$Sex = "IN ('2')";
$_SESSION['sex'] = $Sex;
}
}{
if ($_POST ['age'] == 'all') {
$Age = "IN ('1', '2', '3', '4', '5') ";
$_SESSION ['age'] = $Age;
} else if ($_POST ['age'] == 'U18') {
$Age = "IN ('1') ";
$_SESSION ['age'] = $Age;
} else if ($_POST ['age'] == '1827') {
$Age = "IN ('2') ";
$_SESSION ['age'] = $Age;
} else if ($_POST ['age'] == '2840') {
$Age = "IN ('3') ";
$_SESSION ['age'] = $Age;
} else if ($_POST ['age'] == '4155') {
$Age = "IN ('4') ";
$_SESSION ['age'] = $Age;
} else if ($_POST ['age'] == '55U') {
$Age = "IN ('5') ";
$_SESSION ['age'] = $Age;
}}
}
?>
过滤器:
性别:男女
全部的
年龄:-18-27
28-40 41-55和uuml;伯尔
55全部
好啊
当你过滤sex
==“全部”时,你得到多少分(?),然后我得到所有的分。我不知道为什么。