As u can see the first element in the table navigates to another page.I want to send the Village name to the next pageRegards,Shoaib.🙂"> Take form data to next page - Forums

Forums

Take form data to next page

shoaib 01 Jul, 2010
Hi,

I am using the chronoform to display my records form database.

See the code


<h3> Compleated Projects </h3>
<?php

$result = mysql_query( "SELECT v.Village,v.Mandal,v.District,v.State,p.Estimated_Cost_Rs,p.Project_Academic_Year,DATE_FORMAT(p.Expected_Start_Date,'%m-%d-%Y') ,DATE_FORMAT(p.Expected_Complete_Date,'%m-%d-%Y') 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='Compleated'" )


or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";
print "<table width=600 border=0>\n";
print "<th>Study Center</th>";
print "<th>Mandal</th>";
print "<th>District</th>";
print "<th>State</th>";
print "<th>Total Cost</th>";
print "<th>Academic Year</th>";
print "<th>Started On</th>";
print "<th>Compleated On</th>";
while ($get_info = mysql_fetch_row($result))
{

print "<tr>\n";


echo "<td>"."<a href=\"http://shoaib4.osmprojects.org/donor-list/studycenter-linkpage.html"."\">".$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>".$get_info[4]."</td>";
echo "<td>".$get_info[5]."</td>";
echo "<td>".$get_info[6]."</td>";
echo "<td>".$get_info[7]."</td>";

print "</tr>\n";

}
print "</table>\n";
?>


As u can see the first element in the table navigates to another page.
I want to send the Village name to the next page

Regards,
Shoaib.
🙂
GreyHead 01 Jul, 2010
HI shoaib,

You should be able to add it to the URL
echo "<td><a href='http://shoaib4.osmprojects.org/donor-list/studycenter-linkpage.html?v_name=".$get_info[0]."'>".$get_info[0]."</a></td>";
Thenm you can recover it by getting the value of V-name from the URL in the ChronoForm.

Bob

PS I would use the 'real' URL in there, not the SEF URL.
shoaib 01 Jul, 2010
Hi,

I am Using SEF But I get the value in my url as "v_name=18"

I have a problem in using it in the query.


$result = mysql_query( "SELECT  Project_Name,fabrik_internal_id,Activity_Name,Description  FROM Project where fabrik_internal_id='$v_name'")


is this the right procedure to use it.

I get the error like this

Notice: Undefined variable: v_name in /home/osmodels/public_html/subdomains/shoaib4/components/com_chronocontact/chronocontact.html.php(180) : eval()'d code on line 10



Regards,
Shoaib.
shoaib 02 Jul, 2010
Hi,

can anyone check this thread pl.


Regards,
Shoaib.
GreyHead 02 Jul, 2010
Hi Shoaib,

It looks as though you haven't defined $v_name. You need to get the value from the URL with
<?php
$v_name = JRequest::getString('v_name', '', 'get');
if ( $v_name ) {
  $db =& JFactory::getDBO();
  $query = "
    SELECT `Project_Name`, `fabrik_internal_id`, `Activity_Name`, `Description` 
      FROM `Project` 
      WHERE `fabrik_internal_id` = $db->quote($v_name) ; ";
  $db->setQuery($query);
  $result = $db->loadAssoc();
  . . .
} 
?>


Bob
shoaib 02 Jul, 2010
Hi,

Thanks Bob. I works fine now.

Regards,
Shoaib.
This topic is locked and no more replies can be posted.