PHP - boton activar

 
Vista:

boton activar

Publicado por Walter (3 intervenciones) el 26/08/2005 23:12:48
hola buen dia una ayudita forfa
ne cesito crear un boton de activacion que capture un checkbox y lo pase a un a la variable activo ... echo "<input name='ActivarConsultor.php' type='submit' value='[ Activar ]'> ";

grasias de antemano

<html>
<head>
<script language="JavaScript" type="text/JavaScript">
<!--
function salto(targ,selObj,restore){
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<center> Ordenar en paginas de <select name="vista" onChange="salto('self',this,0)">
<option value="<?php echo $_SERVER['PHP_SELF'] . "?arr_tablas=".$TX . "&vista=4";?>"> </option>
<option value="<?php echo $_SERVER['PHP_SELF'] . "?arr_tablas=".$TX . "&vista=5";?>">5</option>
<option value="<?php echo $_SERVER['PHP_SELF'] . "?arr_tablas=".$TX . "&vista=10";?>">10</option>
<option value="<?php echo $_SERVER['PHP_SELF'] . "?arr_tablas=".$TX . "&vista=15";?>">15</option>
<option value="<?php echo $_SERVER['PHP_SELF'] . "?arr_tablas=".$TX . "&vista=20";?>">20</option>
<option value="<?php echo $_SERVER['PHP_SELF'] . "?arr_tablas=".$TX . "&vista=30";?>">30</option>
</select> registros.<br></center>

<?php

require_once('Structures/DataGrid.php');
require_once('TablaConsultor.php');

$mostrar=new TablaConsultor("alfa_consultor");

echo "<form action='Consultor.php' method='post'><select name='t' onChange=\"salto('self',this,0)\">
<option value='' selected>Seleccionar</option>
<option value='".$_SERVER['PHP_SELF']."?t=1' >Activo</option>
<option value='".$_SERVER['PHP_SELF']."?t=0' >Inactivo</option>
</select>
</form>";

if(isset($_GET["t"]))
{
$num=$_GET["t"];
}
else
{
$num= 1;
}
$mm=$mostrar->seleccionar("activo=$num");

if ($mm[0]=0)
{
echo "jose eres un error de la naturaleza";
}
else
{
$m=$mm[1];
}

/******************************************************************/


class Printer
{
function printLink($params)
{
extract($params);
$id = $record ["COD_CONSULTOR"];
return "<a href=\"$pagina?id=$id&tabla=$tabla&clase=$clase&tipo=$tipo\">$label</a>";

}

function printCheckbox($params)
{
extract($params);

$id = $record ["COD_CONSULTOR"];
return "<input name='check_$id' type='checkbox' value='$id'>";
}
}

// Define New DataGrid with a limit of 3 records

if(isset($_GET["vista"]))
{
$PR=$_GET["vista"];
}
else
{
$PR=5;
}
$dg =& new Structures_DataGrid($PR);

// Define DataGrid Color Attributes
$dg->renderer->setTableHeaderAttributes(array('bgcolor' => '#3399FF'));
$dg->renderer->setTableOddRowAttributes(array('bgcolor' => '#CCCCCC'));
$dg->renderer->setTableEvenRowAttributes(array('bgcolor' => '#EEEEEE'));

// Define DataGrid Table Attributes
$dg->renderer->setTableAttribute('width', '100%');
$dg->renderer->setTableAttribute('cellspacing', '1');
$dg->renderer->setTableAttribute('cellpadding', '4');
$dg->renderer->setTableAttribute('class', 'datagrid');

$dg->renderer->sortIconASC = " ^";
$dg->renderer->sortIconDESC = " v";

if ($num==1)
{
echo '<center>','LISTA DE CONSULTOR ACTIVOS','</center>';

if ($m==null)
{
die('NO HAY DATOS A MOSTRAR');
}
}
else
{
if($num==0)
{
echo '<center>','LISTA DE LOS CONSULTORES INACTIVOS','</center>';

if ($m==null)
{
die('NO HAY DATOS A MOSTRAR');
}
}
else
{
echo 'NO HA HECHO NINGUNA SELECCION';
die('ERROR DE CONNECCION A LA BASE DE DATOS');
}
}
// Set empty row table attributes
$dg->renderer->allowEmptyRows(true, array('bgcolor' => '#FFFFFF'));

// Define columns for the DataGrid
$column = new Structures_DataGrid_Column(null, null, null, array('align' => 'center','width' => '10'), null, 'Printer::printCheckbox()');
$dg->addColumn($column);
$column = new Structures_DataGrid_Column('Edit', null, null, array('align' => 'center','width' => '10'), null, 'Printer::printLink($label=Edit,$pagina=ActualizarConsultor.php,$tabla='.$tabla.',$clase='.$clase.',$tipo=editar)');
$dg->addColumn($column);
$column = new Structures_DataGrid_Column('Código C0nsultor', 'COD_CONSULTOR', 'COD_CONSULTOR', array('width' => '25%'));
$dg->addColumn($column);
$column = new Structures_DataGrid_Column('Código Documento', 'COD_TPODOC_IDENTIDAD', 'COD_TPODOC_IDENTIDAD', array('width' => '25%'));
$dg->addColumn($column);
$column = new Structures_DataGrid_Column('Código Ocupacion', 'COD_OCPCION', 'COD_OCPCION', array('width' => '25%'));
$dg->addColumn($column);
$column = new Structures_DataGrid_Column('Nª Documento', 'NUM_DOCUMENTO', 'NUM_DOCUMENTO', array('width' => '25%'));
$dg->addColumn($column);

// Option #3 Bind directly to any data type
$dg->bind($m);

echo "<div align='center'>";
echo $dg->renderer->getPaging();
echo '</div>';

echo "<form action='EliminarConsultor.php' method='POST' name='form_Grid'>";
echo "<div align='right'><input name='elimina' type='submit' value='[ Eliminar ]'> ";
echo "<a href=\"CrearConsultor.php?id=2&tabla=$tabla&clase=$clase&tipo=nuevo\">[ Nuevo ]</a></div>";

// Print the DataGrid
$dg->render();

echo "<input type='hidden' name='clase' value='$clase'>";
echo "<input type='hidden' name='tabla' value='$tabla'>";
echo "<input name='EliminarConsultor.php' type='submit' value='[ Eliminar ]'> ";
echo "<input name='ActivarConsultor.php' type='submit' value='[ Activar ]'> ";
echo "<a href=\"CrearConsultor.php?id=2&tabla=$tabla&clase=$clase&tipo=nuevo\">[ Nuevo ]</a>";

echo "<div align='center'>";
echo $dg->renderer->getPaging();
echo '</div>';
echo "</form>";
?>

</head>
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder