Hi,
I Using CC for Table Filter on Dropdown change.
I like to show the table data only if the dropdown is selected.
On the form load the table show all the data.
the coding in the where box is
code in body box is
I Using CC for Table Filter on Dropdown change.
I like to show the table data only if the dropdown is selected.
On the form load the table show all the data.
the coding in the where box is
<?php
$pyear = JRequest::getInt('pyear', '', 'post');
if ( $pyear > 0 )
{
echo " WHERE `Project_Year` = '$pyear' AND `Status_Id` = 'Compleated' AND `Activity_Name` = 'Basic Facilities in Schools' ";
}
?>
code in body box is
<table style="text-align: left; width: 99%;" border="1" >
<tr<?php if ($i % 2) echo ' style="background-color: #EBEBEB;"';?>>
<td style="width: 20%;"><a href=index.php?option=com_chronocontact&chronoformname=studycenter_linkpage&v_name={fabrik_internal_id}>{Project_Name}</a></td>
<td style="width: 8%;">{projectmandal}</td>
<td style="width: 8%;">{projectdistrict}</td>
<td style="width: 10%;">{projectstate}</td>
<td style="width: 14%;">{Estimated_Cost_Rs}</td>
<td style="width: 15%;">{Expected_Start_Date}</td>
<td style="width: 15%;">{Expected_Complete_Date}</td>
</tr>
</table>
Hi shoaib,
I'm not sure I understand your question? Where is the drop-down? It needs to be in the CC Header box as part of a Form, then you can use the result in the WHERE Box.
Bob
I'm not sure I understand your question? Where is the drop-down? It needs to be in the CC Header box as part of a Form, then you can use the result in the WHERE Box.
Bob
Hi,
Thanks Now I dont all the values when the dropdown is not selected.
But I see the Dropdown value is not filtered. I am taking a value of Project Academic Year which is some thing like "2009-2010" the $pyear value of the Dropdown takes only "2009" value to filter.
How will I able to acess this value to filter.
To understand better I have attached all my codings.
Where box code:
Header Box Code:
Body Box Code:
Can u pl help me in Access the value as it is "2009-2010" form the dropdown and filter it in the table.
I checked using the project year which has the value "2009" It works well. But with project academic year value "2009-2010" it does not works.
Regards,
Shoaib
Thanks Now I dont all the values when the dropdown is not selected.
But I see the Dropdown value is not filtered. I am taking a value of Project Academic Year which is some thing like "2009-2010" the $pyear value of the Dropdown takes only "2009" value to filter.
How will I able to acess this value to filter.
To understand better I have attached all my codings.
Where box code:
<?php
$pyear = JRequest::getInt('pyear', '', 'post');
if ($pyear == 0)
{
echo " WHERE `Status_Id` = 'Compleated' AND `Activity_Name` = 'Study Centres' ";
}
else
{
echo " WHERE `Project_Academic_Year` = '$pyear' AND `Status_Id` = 'Compleated' AND `Activity_Name` = 'Study Centres' ";
}
?>
Header Box Code:
<h1 style='color:#234FA2;font-family:arial,verdana;font-size:20px;font-weight:bold;'>Study Centers</h1>
<br />
<p style='text-align: justify;'><span style='font-size: small;'><span style='font-family: arial,helvetica,sans-serif;'><strong> </strong></span></span></p>
<table style="width: 100%;" border="0">
<tbody>
<tr>
<td valign="top"><img class="caption" src="images/stories/Proj_60_StuyCenter.jpg" border="0" align="left" /></td>
<td valign="top"><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;"><p style='text-align: justify;'><strong>Problem:</strong> It is a well-known fact that in many villages, the poor students lack basic facilities like electricity. In many cases, parents don't have any education to guide their children in their studies. They also can't afford to send them to any private tuition classes or provide any other additional support. Due to this, many students are not able to get through even 10th class. This failure ratio is discouraging other parents from sending their children to schools.</p><br /><br /><p style='text-align: justify;'><strong>Activity Description:</strong> After identifying the needy village, SPREAD INTERNATIONAL begins to plan for study center in the existing govt. school in that village. This process starts with appointing an instructor and providing other facilities like electricity and lighting. Instructor in turn helps the students in completing their homework and guides them in their study.<br /><br /> </span></p></span></td>
</tr>
</tbody>
</table>
<p style='text-align: justify;'><span style="font-size: small;"><span style="font-family: arial,helvetica,sans-serif;">These study centers are open for the students during pre-school hours and after school hours.</span></span></p>
<p style='color:#234fa2;left:30;font-family:arial,verdana;font-size:16px;
font-weight:bold;'> PROJECTS IN PROGRESS</p>
<?php
$result = mysql_query( "SELECT v.Village,v.Mandal,v.District,v.State,p.Estimated_Cost_Rs,p.Project_Academic_Year,p.fabrik_internal_id FROM Project as p
JOIN Project_Location as v ON v.fabrik_internal_id = p.Village WHERE p.Activity_Name='Study Centres' AND p.Status_Id='In Progress'" )
/*$result2 = mysql_query("SELECT fabrik_internal_id form Project WHERE Activity_Name='Study Centres' AND Status_Id='In Progress'" )*/
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
/*print "There are $num_rows records.<P>";*/
print "<table width=100% border=3 >";
print "<th class='tableHead'>Study Center Village</th>";
print "<th class='tableHead'>Mandal</th>";
print "<th class='tableHead'> District</th>";
print "<th class='tableHead'>State</th>";
print "<th class='tableHead'>Total Cost</th>";
print "<th class='tableHead'>Academic Year</th>";
$i=0;
while ($get_info = mysql_fetch_row($result))
{
if(($i % 2) == 0 )
{
print"<tr>\n";
}
else
{
print"<tr style='background-color: #EBEBEB;'>\n";
}
echo "<td >"."<a href=\"index.php?option=com_chronocontact&chronoformname=studycenter_linkpage&v_name=".$get_info[6]."\">".$get_info[0]."</a>"."</td>";
echo "<td >".$get_info[1]."</td>";
echo "<td >".$get_info[2]."</td>";
echo "<td >".$get_info[3]."</td>";
echo "<td class ='tablecolor'>".'$'.''.$get_info[4]."</td>";
echo "<td >".$get_info[5]."</td>";
//echo "<td>".$get_info[6]."</td>";
print"<tr>\n";
$i++;
}
print "</table>\n";
?>
<!--[if gt IE 6]>
<p style='color:#234fa2;left:30;font-family:arial,verdana;font-size:16px;
font-weight:bold;'> COMPLETED PROJECTS</p>
<table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr><p>
<select name="pyear" id="pyear">
echo "<option value=0>Select Year</option>";
<?php
$result = mysql_query( "SELECT Project_Year FROM Project where Status_Id='Compleated' AND `Activity_Name` = 'Study Centres' " )
or die("SELECT Error: ".mysql_error());
if($result != 0)
{
while($row = mysql_fetch_array($result,MYSQL_NUM)) {
echo "<option value='$row[0]'>$row[0]</option>";
}
}
?>
</select>
</tr>
</tbody>
<tr style='float:right;margin-right:842px;margin-top:-26px;border:0px;'>
<input type="submit" value="GO!" height = "10px" width= "10px" /></tr></p>
</table>
<table style="text-align: left; width: 99%;" border="1" >
<tbody>
<th style="font-weight: bold; width: 20%;">Study Center Village</th>
<th style="font-weight: bold; width: 20%;">Total Cost</th>
<th style="font-weight: bold; width: 20%;">Academic Year</th>
<th style="font-weight: bold; width: 20%;">Started On</th>
<th style="font-weight: bold; width: 20%;">Compleated On</th>
</tbody>
<!--[else]>
<p style='color:#234fa2;left:30;font-family:arial,verdana;font-size:16px;
font-weight:bold;'> COMPLETED PROJECTS</p>
<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="0">
<tbody>
<tr>
// ************** here is the Dropdown *******************
<select name="pyear" id="pyear">
echo "<option value=0>Select Year</option>";
<?php
$result = mysql_query( "SELECT Project_Acdemic_Year FROM Project where Status_Id='Compleated' AND `Activity_Name` = 'Study Centres' " )
or die("SELECT Error: ".mysql_error());
if($result != 0)
{
while($row = mysql_fetch_array($result,MYSQL_NUM)) {
echo "<option value='$row[0]'>$row[0]</option>";
}
}
?>
</select>
</tbody>
<input type="submit" value="GO!" height = "10px" width= "10px" />
</table>
<table style="text-align: left; width: 99%;" border="1" >
<tbody>
<th style="font-weight: bold; width: 20%;">Study Center Village</th>
<th style="font-weight: bold; width: 20%;">Total Cost</th>
<th style="font-weight: bold; width: 20%;">Academic Year</th>
<th style="font-weight: bold; width: 20%;">Started On</th>
<th style="font-weight: bold; width: 20%;">Compleated On</th>
</tbody>
<![endif]-->
Body Box Code:
<tr<?php if ($i % 2) echo ' style="background-color: #EBEBEB;"';?>>
<td style="width: 20%;"><a href=index.php?option=com_chronocontact&chronoformname=studycenter_linkpage&v_name={fabrik_internal_id}>{projectlocationhidden}</a></td>
<td style="width: 20%;">${Estimated_Cost_Rs}</td>
<td style="width: 20%;">{Project_Academic_Year}</td>
<td style="width: 20%;"><?php $pre = strtotime('Expected_Start_Date');
echo date('Y/m/d',$pre); ?></td>
<td style="width: 20%;"><?php $previous_date = strtotime('Expected_Complete_Date');
echo date('Y/m/d',$previous_date); ?></td>
</tr>
<?php $i++ ?>
Can u pl help me in Access the value as it is "2009-2010" form the dropdown and filter it in the table.
I checked using the project year which has the value "2009" It works well. But with project academic year value "2009-2010" it does not works.
Regards,
Shoaib
Hi Shoaib,
I'm really sorry but I don't have time today to try to understand your code. You really do need to get someone experienced to help you with this.
Bob
I'm really sorry but I don't have time today to try to understand your code. You really do need to get someone experienced to help you with this.
Bob
Hi Bob,
Can You please look of the Code whenever you have time. This this is the major problem that I face now.
I think the problem is on the Dropdown Value. Actually the Dropdown contain the value something like "2009-2010" the $pyear in the Where box takes only the value "2009". It seem there is the problem because of "-" between.
Please do the needful.
Regards,
Shoaib.
Can You please look of the Code whenever you have time. This this is the major problem that I face now.
I think the problem is on the Dropdown Value. Actually the Dropdown contain the value something like "2009-2010" the $pyear in the Where box takes only the value "2009". It seem there is the problem because of "-" between.
Please do the needful.
Regards,
Shoaib.
This topic is locked and no more replies can be posted.