.... No deseo seguir cargando y enviando los datos. Lo que Busco es que en ves de un Checkbox exista un un boton por cada item, y al dar clic sobre este se envie el dato a la otra pagina.
ingresarccp.php
Código PHP:
<html>
<body>
<form name = forma action = "" method = post id="forma" onSubmit="return jsValidateForm(this)" ><fieldset style="width:980px;">
<table width="22%" border="0">
<tr>
<td width="32%" height="24"><div align="center"><font size="2"> <strong>C.U:
</strong></font></div></td>
<td width="21%"><div align="center"><font size="2">
<input name="indcu" type="text" id="indcu" size="2" maxlength="2" validation="numeric" validationhint="required" validationmsg="El campo C.U es de tipo numerico y obligatorio">
</font></div></td>
<td width="47%"><font size="2"><a href="pasarvalorcu.php" onClick="vent = window.open('pasarvalorcu.php','vent','height=540,width=790,scrollbars=yes, resizable=yes'); vent.focus(); return false"><img src="../ICONOS/Buscar.gif" width="92" height="16" border="0"></a></font></td>
</tr>
</table>
</form>
</body>
</html>
pasarvalorcu.php
Código PHP:
<HTML>
<BODY bgColor=#FBEED7>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php
//Funcion para conectarme a la Base de Datos Mysql
function conectar()
{
if (!($link=mysql_connect("localhost","root","")))
{
echo "Error conectando a la base de datos.";
exit();
}
if (!mysql_select_db("sigdoc",$link))
{
echo "Error seleccionando la base de datos.";
exit();
}
return $link;
}
$link=conectar();
?>
<form name="form1" method="post" action="">
<table width="100%" border="0">
<tr>
<td width="72%" height="25" bgcolor="#FFFFFF"> <div align="right"><font color="#006600" size="5" face="Arial, Helvetica, sans-serif"><strong><strong><strong><font color="#FF0000" size="3">*
<font color="#FF9900">Para enviar el dato de clic en el boton</font></font><font size="3">
<font color="#000000">Enviar</font></font></strong></strong></strong></font><font color="#771BA9" size="5"><strong><strong><strong></strong></strong></strong></font><font color="#FF9900" size="5"><strong><strong><strong></strong></strong></strong></font></div></td>
<td width="28%" bgcolor="#FFFFFF"> <div align="right"> </div>
<div align="right"> <font color="#FF9900">
<?
if (isset($_POST['seleccion'])){
// Generamos una lista de los ID's (campo value= ..) que tenemos en nuestro array.
foreach ($_POST['seleccion'] as $lista){
?>
<input name="cu" type="text" id="cu" value="<?php echo $lista ?>" size="2" maxlength="2">
<script language="JavaScript" type="text/JavaScript">
function envia(){
var indcu = document.form1.cu.value
opener.document.forma.indcu.value = indcu
close();
}
</script>
<?
}// fin foreach
}else{
?>
<input name="cu" type="text" id="cu" value="<?php echo $lista ?>" size="2" maxlength="2">
<script language="JavaScript" type="text/JavaScript">
function envia(){
var indcu = document.form1.cu.value
opener.document.forma.indcu.value = indcu
close();
}
</script>
<?
}// fin del if
?>
<font size="5"><strong><font size="5"><strong><font size="5"><strong><font size="5"><strong><font size="5"><strong><font size="5"><strong><font size="4" face="Verdana, Arial, Helvetica, sans-serif">
<input type="button" name="Submit" value="Enviar" onClick="javascript: envia()">
</font></strong></font></strong></font></strong></font></strong></font></strong></font></strong></font></font>
</div></td>
</tr>
<tr>
<td height="21" colspan="2" bgcolor="#FFFFFF"> <div align="right"><font size="5"><strong><font size="5"><strong><font size="5"><strong><font color="#FF0000" size="3" face="Arial, Helvetica, sans-serif">*
<font color="#FF9900">Para Cargar el dato de clic boton</font> </font><font size="3" face="Arial, Helvetica, sans-serif"><strong><strong><strong><font color="#000000">Cargar
datos</font></strong></strong></strong></font></strong></font></strong></font></strong></font>
</div></td>
</tr>
<tr>
<td height="26" colspan="2"> <table width="100%" height="24" border="0" cellspacing=0 bgcolor="#F4F4FF" class=tablaCont>
<tbody>
<tr bgcolor="#FFCC66" class=trmarca>
<td width="35%" height="24" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px">
<div align="right"><font color="#000000"><strong></strong></font></div></td>
<td width="11%" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px">
<div align="left"><font color="#000000" size="2"><strong><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif">CU</font></strong></font></div></td>
<td width="54%" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px">
<div align="left"><font color="#000000" size="2"><strong><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif">Descripcion</font></strong></font></div></td>
</tr>
</tbody>
</table></td>
</tr>
</table>
<?php
// Ejecutar la consulta para obtener los datos de la BD.
$resultado=mysql_query("SELECT * FROM cu order by indcu");
// Extraemos y componemos los checbox dinámicos de los datos de nuestra tabla de la BD.
while ($row = mysql_fetch_array($resultado)){
?>
<table width="100%" height="24"
border=0 cellpadding=0 cellspacing=0 bgcolor=#F2FBD7>
<tbody>
<tr>
<td width=751 height="24" align=left bgcolor=#FBEED7>
<table width="100%" border="0" cellspacing=0 class=tablaCont>
<tbody>
<tr bgcolor="#FBEED7" class=trmarca>
<td width="36%" height="24" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px">
<div align="right"><font color="#000000"> </font></div></td>
<td width="3%" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px"><div align="center"><font color="#000000">
<input name="seleccion[]" type="checkbox" id="indcu" value="<? echo $row['indcu']; ?>">
</font></div></td>
<td width="11%" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px"><div align="left"><font color="#000000"><? echo "<value=\"".$row['indcu']."\">".$row['indcu']."<br>"; ?></font></div></td>
<td width="42%" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px">
<div align="left"></div>
<? echo "<value=\"".$row['indcu']."\">".$row['descripcu']."<br>"; ?></td>
<td width="8%" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px"><div align="right"><font color="#FF9900" size="5"><strong><strong><strong><strong><strong><strong><font size="4" face="Verdana, Arial, Helvetica, sans-serif">
<input name="Cargar datos" type="submit" id="Cargar datos" value="Cargar datos">
</font></strong></strong></strong></strong></strong></strong></font></div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<?php
}// Fin de while
?>
<div align="right">
<table width="100%" border="0">
<tr bgcolor="#FFCC99">
<td width="100%" bgcolor="#FFCC66"> </td>
</tr>
</table>
<p><font size="5"><strong><font color="#FF3366" size="4" face="Verdana, Arial, Helvetica, sans-serif">
</font></strong></font> </p>
</div>
</form>
</body>
</html>
Esta es la BD.
CREATE DATABASE `sigdoc`;
USE sigdoc;
CREATE TABLE `cu` (
`indcu` char(2) NOT NULL default '',
`descripcu` varchar(15) NOT NULL default '',
`direccion` varchar(25) default NULL,
`ciudad` varchar(12) default NULL,
`departamento` varchar(12) default NULL,
`pais` varchar(12) default NULL,
`telefono` varchar(15) default NULL,
`fax` varchar(15) default NULL,
PRIMARY KEY (`indcu`)
) TYPE=InnoDB;
INSERT INTO `cu` VALUES ('01', 'OFICINA CENTRAL', 'CL 13 5 01 EDIF EL CAFÉ', 'CALI', 'VALLE', 'COLOMBIA', '8833669', '8897751');
INSERT INTO `cu` VALUES ('02', 'PPN VENECIA', 'CORREGIMIENTO VENECIA', 'TRUJILLO', 'VALLE', 'COLOMBIA', '2260113', '');
INSERT INTO `cu` VALUES ('03', 'PPN SAN ANTONIO', 'CORREGIMIENTO SAN ANTONIO', 'SEVILLA', 'VALLE', 'COLOMBIA', '2199873', '');
INSERT INTO `cu` VALUES ('04', 'PPN ULLOA', 'ULLOA', 'ULLOA', 'VALLE', 'COLOMBIA', '2075122', '');
INSERT INTO `cu` VALUES ('05', 'PPN DAGUA', 'DAGUA', 'DAGUA', 'VALLE', 'COLOMBIA', '2451572', '2450426');
INSERT INTO `cu` VALUES ('06', 'PPN LA TULIA', 'CORREGIMIENTO LA TULIA', 'BOLIVAR', 'VALLE', 'COLOMBIA', '2299745', '');
INSERT INTO `cu` VALUES ('07', 'PPN SALONICA', 'CORREGIMIENTO SALONICA', 'RIOFRIO', 'VALLE', 'COLOMBIA', '2008054', '2008085');
INSERT INTO `cu` VALUES ('08', 'PPN VERSALLES', 'VERSALLES', 'VERSALLES', 'VALLE', 'COLOMBIA', '2213565', '2213410');
INSERT INTO `cu` VALUES ('09', 'PPN LA MARINA', 'CORREGIMIENTO LA MARINA', 'TULUA', 'VALLE', 'COLOMBIA', '2260738', '2260144');
INSERT INTO `cu` VALUES ('11', 'PPN POTRERILLO', 'CORREGIMIENTO POTRERILLO', 'PALMIRA', 'VALLE', 'COLOMBIA', '2580514', '');
INSERT INTO `cu` VALUES ('12', 'PPN CAICEDONIA', 'CAICEDONIA', 'CAICEDONIA', 'VALLE', 'COLOMBIA', '2165818', '2163451');
Gracias por su Ayuda...