Hi, i´m trying to get data from a html dinamic table that it´s created in the form html with this code:
This code just takes information from a txt file and put it into a table with a checkbox at the begining of every line.
I would like to take the information from the second column (named paquete) when submiting and put it into a new txt file.
Could be something like this?
Thanks a lot.
<style>
@import url(templates/form.css);
</style>
<?
session_start();
$repositorio=$_SESSION["archivo"];
$sec=$_SESSION["sec"];
echo "<table id='tablapaquetes' border = '1'> \n";
echo "<tr>";
echo "<td bgcolor='#FF0000'><strong> </strong></td>";
echo "<td align='center' bgcolor='#FF0000'><strong>Paquete</strong></td>";
echo "<td align='center' bgcolor='#FF0000'><strong>Seccion</strong></td>";
echo "<td align='center' bgcolor='#FF0000'><strong>Descripcion</strong></td>";
echo "<tr>";
$i=0;
$fichero='/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_gutsy_'.$repositorio.'_binary-i386_Packages';
$archivo = fopen ($fichero, "r");
while (!feof ($archivo))
{
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'))
{
if(($repositorio[0]=='m')&&($repositorio[1]=='a'))
{
$temp=substr ($linea, 9, 40);
$seccion=trim($temp);
}if(($repositorio[0]=='m')&&($repositorio[1]=='u'))
{
$temp=substr ($linea, 20, 40);
$seccion=trim($temp);
}if(($repositorio[0]=='u')&&($repositorio[1]=='n'))
{
$temp=substr ($linea, 18, 40);
$seccion=trim($temp);
}if(($repositorio[0]=='r')&&($repositorio[1]=='e'))
{
$temp=substr ($linea, 20, 40);
$seccion=trim($temp);
}
}
if (($linea[0] == 'D') && ($linea[1] == 'e')&& ($linea[2] == 's'))
{
$temp=substr ($linea, 13, 150);
$desc=trim($temp);
if(($seccion[0]==$sec[0])&&($seccion[1]==$sec[1])&&($seccion[2]==$sec[2])&&($desc[0]!=''))
{
echo "<td><INPUT type='checkbox' name='";
echo "check'.$i.''></td>";
echo "<td align='center' bgcolor='#CCCCCC'><strong>$pack</strong></td>";
echo "<td align='center' bgcolor='#CCCCCC'><strong>$seccion</strong></td>";
echo "<td align='center' bgcolor='#CCCCCC'><strong>$desc</strong></td>";
echo "</tr>";
$i++;
}
}
}
}
echo $i;
echo "</table>";
session_start();
$_SESSION["i"] = $i;
?>
<p align="center"><INPUT type="submit" name="boton1" value="Añadir a la distribución"></p>
This code just takes information from a txt file and put it into a table with a checkbox at the begining of every line.
I would like to take the information from the second column (named paquete) when submiting and put it into a new txt file.
Could be something like this?
<?php
session_start();
$contador=$_SESSION["i"];
echo $contador;
for($p=0;$p<$contador;$p++)
{
$check=check.$p;
if(( $_POST['$check'] == "on" ))
{
echo $p;
}
}
?>
Thanks a lot.