Forums

html dinamic table

wachusfleish 22 Jul, 2008
Hi, i would like to know if its possible when submitting a form execute a php script that creates a dinamic table with data from a txt file and checkboxes, it is possible to use that checkboxes and data? how?
This is the code execute after submitting the previous form:

<?php

echo "<table id='tablapaquetes' border = '1'> \n";
echo "<tr>";
$i=0;
$fichero='/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_gutsy_universe_binary-i386_Packages';
$archivo = fopen ($fichero, "r"); 
while (!feof ($archivo)){
    //si extraigo una línea del archivo y no es false
	while($linea = fgets($archivo))
	{
		if (($linea[0] == 'P') && ($linea[1] == 'a')&& ($linea[2] == 'c'))
        	{ 
			$temp=substr ($linea, 9, 40); 
			$pack=trim($temp);		
				
		}
		if(($linea[0]=='S')&&($linea[1]=='e')&&($linea[2]=='c'))
		{
			$temp=substr ($linea, 18, 40);
			$seccion=trim($temp);
			if(($seccion[0]=='x')&&($seccion[1]=='1'))
			{
				echo "<td><INPUT type='checkbox' name='";
				echo "check'.$i.''></td>";
				echo "<td width='20' align='center' bgcolor='#CCCCCC'><strong>$pack</strong></td>";
				echo "<td width='20' align='center' bgcolor='#CCCCCC'><strong>$seccion</strong></td>";
				echo "</tr>";
				$i++;
			}
		}
	}
}

echo $i;

echo "</table>";


?>

and i would like to use the names of the packages selected by the user and put them into a txt.
GreyHead 23 Jul, 2008
Hi wachusfleish,

From a quick look you should be able to use that code in the form html box of ChronoForms.

You can process the form results in the OnSubmit boxes and save or email them as you wish.

Bob
wachusfleish 23 Jul, 2008
That´s it!!
I didn´t know that you could use php code in form html.
Thanks a lot GreyHead for your help.
:)
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger