<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://php.apsique.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Php y otras yerbas - Insertando datos en la base de datos usando campos de texto y checkbox - Comentarios</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox</link>
 <description>Comentarios para &quot;Insertando datos en la base de datos usando campos de texto y checkbox&quot;</description>
 <language>es</language>
<item>
 <title>Hola
En la pagina de</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comment-78790</link>
 <description>&lt;p&gt;Hola&lt;/p&gt;
&lt;p&gt;En la pagina de webestilo, encontre sus correos. Espero me puedan ayudar con una pagina&lt;/p&gt;
&lt;p&gt;Cree una coneccion conex.php&lt;/p&gt;
&lt;p&gt;&amp;lt;?php&lt;br /&gt;
$dbh=mysql_connect (&quot;localhost&quot;, &quot;gecycom_dixon&quot;, &quot;camilo&quot;) or die (&#039;I cannot connect to the database because: &#039; . mysql_error());&lt;br /&gt;
mysql_select_db (&quot;gecycom_basedatos&quot;);&lt;br /&gt;
?&amp;gt;&lt;/p&gt;
&lt;p&gt;Un archivo procesar.php&lt;/p&gt;
&lt;p&gt;&amp;lt;?php&lt;br /&gt;
   include(&quot;conex.php&quot;);&lt;br /&gt;
   $link=Conectarse();&lt;br /&gt;
   $OT=$_GET[&#039;OT&#039;];&lt;br /&gt;
   $Contrato=$_GET[&#039;Contrato&#039;];&lt;br /&gt;
   $NombreObra=$_GET[&#039;NombreObra&#039;];&lt;br /&gt;
   $Direccion=$_GET[&#039;Direccion&#039;];&lt;br /&gt;
   $FInicio=$_GET[&#039;FInicio&#039;];&lt;br /&gt;
   $FFin=$_GET[&#039;FFin&#039;];&lt;br /&gt;
   $PAlam=$_GET[&#039;PAlam&#039;];&lt;br /&gt;
   $PProg=$_GET[&#039;PProg&#039;];&lt;br /&gt;
   $PInal=$_GET[&#039;PInal&#039;];&lt;br /&gt;
   $Tecnico=$_GET[&#039;Tecnico&#039;];&lt;br /&gt;
   $Ayudante=$_GET[&#039;Ayudante&#039;];&lt;br /&gt;
   $PagoTecnico=$_GET[&#039;PagoTecnico&#039;];&lt;br /&gt;
   $PagoColsecurity=$_GET[&#039;PagoColsecurity&#039;];&lt;br /&gt;
   $Factura=$_GET[&#039;Factura&#039;];&lt;br /&gt;
   $NDLS=$_GET[&#039;NDLS&#039;];&lt;br /&gt;
   $DLS=$_GET[&#039;DLS&#039;];&lt;br /&gt;
   $FA=$_GET[&#039;FA&#039;];&lt;br /&gt;
   $Comentarios=$_GET[&#039;Comentarios&#039;];&lt;br /&gt;
   $Observaciones=$_GET[&#039;Observaciones&#039;];&lt;br /&gt;
   mysql_query(&quot;insert into prueba (OT,Contrato,NombreObra,Direccion,FInicio,FFin,PAlam,PProg,PInal,Tecnico,Ayudante,PagoTecnico,PagoColsecurity,Factura,NDLS,DLS,FA,Comentarios,Observaciones) values (&#039;$OT&#039;,&#039;$Contrato&#039;,&#039;$NombreObra&#039;,&#039;$Direccion&#039;,&#039;$FInicio&#039;,&#039;$FFin&#039;,&#039;$PAlam&#039;,&#039;$PProg&#039;,&#039;$PInal&#039;,&#039;$Tecnico&#039;,&#039;$Ayudante&#039;,&#039;$PagoTecnico&#039;,&#039;$PagoColsecurity&#039;,&#039;$Factura&#039;,&#039;$NDLS&#039;,&#039;$DLS&#039;,&#039;$FA&#039;,&#039;$Comentarios&#039;,&#039;$Observaciones)&quot;,$link); &lt;/p&gt;
&lt;p&gt;   header(&quot;Location: ejem07d.php&quot;);&lt;br /&gt;
?&amp;gt; &lt;/p&gt;
&lt;p&gt;una pagina de acceso http://www.gecyc.com/base/ejem07d.php&lt;/p&gt;
&lt;p&gt;   BASE DE DATOS COLSECURITY &lt;/p&gt;
&lt;p&gt;   Orden de Trabajo: &lt;/p&gt;
&lt;p&gt;   Contrato:&lt;/p&gt;
&lt;p&gt;   &amp;nbsp;&lt;br /&gt;
   &amp;nbsp;&lt;br /&gt;
   &amp;nbsp;&lt;br /&gt;
   &amp;nbsp;&lt;/p&gt;
&lt;p&gt;   Nombre de la Obra: &lt;/p&gt;
&lt;p&gt;   Direccion &lt;/p&gt;
&lt;p&gt;   Fecha Inicio:  &lt;/p&gt;
&lt;p&gt;   Fecha Fin: &lt;/p&gt;
&lt;p&gt;   Puntos Alambrados: &lt;/p&gt;
&lt;p&gt;   Puntos Programados: &lt;/p&gt;
&lt;p&gt;   Puntos Inalambricos: &lt;/p&gt;
&lt;p&gt;   Tecnico: &lt;/p&gt;
&lt;p&gt;  Ayudante:&lt;/p&gt;
&lt;p&gt;   Pago Tecnico:  &lt;/p&gt;
&lt;p&gt;   Pago Colsecurity: &lt;/p&gt;
&lt;p&gt;   Factura:&lt;/p&gt;
&lt;p&gt;   Numero DLS: &lt;/p&gt;
&lt;p&gt;   DLS:&lt;/p&gt;
&lt;p&gt;   FA:&lt;/p&gt;
&lt;p&gt;  Comentarios:&lt;/p&gt;
&lt;p&gt;  Observaciones:&lt;/p&gt;
&lt;p&gt;&amp;lt;?php&lt;br /&gt;
   include(&quot;conex.phtml&quot;);&lt;br /&gt;
   $link=Conectarse();&lt;br /&gt;
   $result=mysql_query(&quot;select * from prueba&quot;,$link);&lt;br /&gt;
?&amp;gt;&lt;/p&gt;
&lt;p&gt;      Orden Principal&lt;br /&gt;
      Contrato Principal&lt;br /&gt;
      Nombre  Obra&amp;nbsp;&lt;br /&gt;
      Direccion&amp;nbsp;&lt;br /&gt;
      Fecha Inicio&amp;nbsp;&lt;br /&gt;
      Fecha Terminacion&amp;nbsp;&lt;br /&gt;
      Puntos Alamb&amp;nbsp;&lt;br /&gt;
      Puntos Progra&amp;nbsp;&lt;br /&gt;
      Puntos Inalam&amp;nbsp;&lt;br /&gt;
      Tecnico&amp;nbsp;&lt;br /&gt;
      Ayudante&amp;nbsp;&lt;br /&gt;
      Pago Tecnico&amp;nbsp;&lt;br /&gt;
      Pago Colsecurity&lt;br /&gt;
      Factura&lt;br /&gt;
      Numero DLS&lt;br /&gt;
      DLS&lt;br /&gt;
      FA&lt;br /&gt;
      Comentarios&lt;br /&gt;
      Observaciones&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;lt;?php&lt;br /&gt;
   while($row = mysql_fetch_array($result)) {&lt;br /&gt;
      printf(&quot;&amp;nbsp;%s &amp;nbsp;%s&amp;nbsp;&quot;, $row[&quot;OT&quot;], $row[&quot;Contrato&quot;], $row[&quot;NombreObra&quot;], $row[&quot;Direccion&quot;], $row[&quot;FInicio&quot;], $row[&quot;FFin&quot;], $row[&quot;PAlam&quot;], $row[&quot;PProg&quot;], $row[&quot;PInal&quot;], $row[&quot;Tecnico&quot;], $row[&quot;Ayudante&quot;], $row[&quot;PagoTecnico&quot;], $row[&quot;PagoColsecurity&quot;], $row[&quot;Factura&quot;], $row[&quot;NDLS&quot;], $row[&quot;DLS&quot;], $row[&quot;FA&quot;], $row[&quot;Comentarios&quot;], $row[&quot;Observaciones&quot;]);&lt;br /&gt;
   }&lt;br /&gt;
   mysql_free_result($result);&lt;br /&gt;
   mysql_close($link);&lt;br /&gt;
?&amp;gt; &lt;/p&gt;
&lt;p&gt;Espero me colaboren con el error....&lt;/p&gt;
&lt;p&gt;gracias&lt;/p&gt;
</description>
 <pubDate>Sun, 16 Mar 2008 18:30:55 -0700</pubDate>
 <dc:creator>Dixon</dc:creator>
 <guid isPermaLink="false">comment 78790 at http://php.apsique.com</guid>
</item>
<item>
 <title>Hola! Oye yo tengo un</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comment-70967</link>
 <description>&lt;p&gt;Hola! Oye yo tengo un problema para insertar datos a la base de datos, este es el codigo que estoy utilizando pero no se cual sea el problema y porque no me puede agregar los datos, espero que me puedas ayudar! Gracias&lt;/p&gt;
&lt;div class=&#039;code&#039;&gt;&lt;div class=&quot;hl-main&quot;&gt;&lt;ol class=&quot;hl-main&quot;&gt;&lt;li&gt;&amp;nbsp;&lt;span class=&quot;hl-inlinetags&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;Conexion con la base&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;mysql_connect(&amp;quot;localhost&amp;quot;,&amp;quot;root&amp;quot;); &lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;selección de la base de datos con la   vamos a trabajar &lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;mysql_select_db(&amp;quot;residencia&amp;quot;);&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;conexion.php&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;Ejecucion de la sentencia SQL&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;mysql_query&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;INSERT INTO medicamento (grupo, nombre,clave,formula,prioridad , presentacion, contenido,unidad_medida,existencia,nivel ) VALUES (&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;[clave],&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;[nombre],&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;[grupo],&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;[prioridad],&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;[formula],&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;[presentacion],&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;[unidad_medida],&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;[nivel],&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;[existencia],&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;[contenido])&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-inlinetags&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Tue, 20 Nov 2007 21:32:00 -0800</pubDate>
 <dc:creator>Perejilillo desconocido</dc:creator>
 <guid isPermaLink="false">comment 70967 at http://php.apsique.com</guid>
</item>
<item>
 <title>Recuerda que debes descargar</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comment-70299</link>
 <description>&lt;p&gt;Recuerda que debes descargar adodb y poner el directorio &quot;adodb&quot; donde está tu archivo .php.&lt;/p&gt;
</description>
 <pubDate>Thu, 20 Sep 2007 12:38:42 -0700</pubDate>
 <dc:creator>clbustos</dc:creator>
 <guid isPermaLink="false">comment 70299 at http://php.apsique.com</guid>
</item>
<item>
 <title>holas en el ejeemplo que me</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comment-70295</link>
 <description>&lt;p&gt;holas en el ejeemplo que me mostrase m eda errorr en&lt;br /&gt;
include(&quot;adodb/adodb.inc.php&quot;);&lt;br /&gt;
$db = &amp;amp;ADONewConnection(&quot;mysql&quot;);&lt;br /&gt;
$db-&amp;gt;connect(&#039;localhost&#039;,&#039;test&#039;,&#039;test&#039;,&#039;test&#039;);&lt;/p&gt;
&lt;p&gt;$items=$db-&amp;gt;getCol(&quot;SELECT id from test_item ORDER BY id&quot;);&lt;/p&gt;
&lt;p&gt;osea crea la base datos con el nombre de test las 3 tablas y todo ok pero cuando corres nada te agradeceria esta ayuadadita ya que esoty buscando emjemplo de selccion multiple y guardar los mismos en una base datos, bueno no te aburro maas, com ya te lo dije te agradeceria mucho esta ayuaddita&lt;/p&gt;
</description>
 <pubDate>Thu, 20 Sep 2007 09:13:15 -0700</pubDate>
 <dc:creator>Perejilillo desconocido</dc:creator>
 <guid isPermaLink="false">comment 70295 at http://php.apsique.com</guid>
</item>
<item>
 <title>Hola Que Tal... Necesito</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comment-66232</link>
 <description>&lt;p&gt;Hola Que Tal... Necesito Ayuda&lt;br /&gt;
Es Erika Tengo este codigo&lt;/p&gt;
&lt;p&gt;Siglas de la Emisora&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$consulta= &quot;SELECT codp FROM programas &quot;;&lt;br /&gt;
$resultado= mysql_query($consulta,$enlace);&lt;br /&gt;
mysql_error($enlace);&lt;/p&gt;
&lt;p&gt;   if (mysql_num_rows($resultado)&amp;gt;0){&lt;br /&gt;
   $cont=0;&lt;br /&gt;
  while (list($codp)= mysql_fetch_row($resultado)){&lt;/p&gt;
&lt;p&gt; echo &quot;&quot;;&lt;/p&gt;
&lt;p&gt; echo &quot;&quot;;&lt;br /&gt;
  print(&quot;$codp&quot;); echo &quot;&quot;;&lt;br /&gt;
$cont=$cont+1;&lt;/p&gt;
&lt;p&gt;}//while&lt;br /&gt;
}//if&lt;br /&gt;
$c=$cont;&lt;br /&gt;
echo &quot;&quot;;&lt;br /&gt;
print(&quot;	 &quot;);&lt;br /&gt;
?&amp;gt;&lt;/p&gt;
&lt;p&gt;Como hago para que los checkbox que se muestren al checar uno y dar click en guardar se guarde eln la base de datos! &lt;/p&gt;
&lt;p&gt;Porfa responder a mi email erika16lozada@hotmail&lt;br /&gt;
Gracias Es urgente!&lt;/p&gt;
</description>
 <pubDate>Wed, 18 Jul 2007 11:33:37 -0700</pubDate>
 <dc:creator>Perejilillo desconocido</dc:creator>
 <guid isPermaLink="false">comment 66232 at http://php.apsique.com</guid>
</item>
<item>
 <title>que decir, me parece un sitio</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comment-65448</link>
 <description>&lt;p&gt;que decir, me parece un sitio genial, y con ayuda muy precisa. Da gusto ver como en las comunidades de software libre prima el ayudarse los unos a los otros.&lt;/p&gt;
&lt;p&gt;lo único que le hecho en falta sería explicar en detalle para los mas novatos que hace cada línea. Por lo demás brutal.&lt;/p&gt;
&lt;p&gt;Un saludo&lt;/p&gt;
&lt;p&gt;oskar&lt;/p&gt;
</description>
 <pubDate>Sun, 21 Jan 2007 02:57:07 -0800</pubDate>
 <dc:creator>oskar</dc:creator>
 <guid isPermaLink="false">comment 65448 at http://php.apsique.com</guid>
</item>
<item>
 <title>hola que tal .. me gustaria p</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comment-47993</link>
 <description>&lt;p&gt;hola que tal .. me gustaria poder contactarme contigo por msn.. si puedes agregame para revisar algo sobre el codigo que esta posteado en la pagina..&lt;br /&gt;
salu2&lt;br /&gt;
maberick27@hotmail.com&lt;/p&gt;
</description>
 <pubDate>Wed, 27 Sep 2006 08:31:31 -0700</pubDate>
 <dc:creator>Perijilillo Desconocido</dc:creator>
 <guid isPermaLink="false">comment 47993 at http://php.apsique.com</guid>
</item>
<item>
 <title>Hoola...muchas gracias, lo vo</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comment-47959</link>
 <description>&lt;p&gt;Hoola...muchas gracias, lo voy a checar pero precisamente es lo que buscaba. Excelente blog.&lt;/p&gt;
</description>
 <pubDate>Mon, 11 Sep 2006 10:19:27 -0700</pubDate>
 <dc:creator>Silver</dc:creator>
 <guid isPermaLink="false">comment 47959 at http://php.apsique.com</guid>
</item>
<item>
 <title>GRACIAS...!!!!!!</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comment-47915</link>
 <description>&lt;p&gt;ME ACABA DE SALVAR.... DE VERDAD GRACIAS POR EL APORTE QUE HA HECHO, NO SABIA COMO SALIR DE ESTE EMBROLLO.&lt;/p&gt;
&lt;p&gt;GRACIAS.&lt;/p&gt;
&lt;p&gt;ATTE: HAROLD&lt;/p&gt;
</description>
 <pubDate>Fri, 11 Aug 2006 18:32:39 -0700</pubDate>
 <dc:creator>Harold Jimenez</dc:creator>
 <guid isPermaLink="false">comment 47915 at http://php.apsique.com</guid>
</item>
<item>
 <title>Bien hecho, pero..</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comment-47901</link>
 <description>&lt;p&gt;Das una manera rapida de recoger los datos para el INSERT por medio del array seleccion[ ], tanto en el articulo que leemos como en el ejemplo que se puede descargar.&lt;/p&gt;
&lt;p&gt;Pero permiteme hacer un apunte: el modo de insertar los datos en la base de datos es un tanto repetitivo. Quiza no para nosotros, pero ya que el bucle foreach es inevitable en php, por lo menos ahorraselo al gestor de bases de datos. Seria mejor meterlos todos de una vez del siguiente modo:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
$valores = &quot;&quot;;&lt;br /&gt;
foreach ($_POST[&#039;seleccion&#039;] as $seleccion) {&lt;br /&gt;
      $valores .= &quot;($id_persona, $seleccion)&quot;;&lt;br /&gt;
      }&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
$db-&amp;gt;execute(&quot;INSERT INTO persona_seleccion (id_persona,id_item) VALUES $valores&quot;);&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
Y de este modo le ahorramos al servidor SQL unas cuantas conexiones, y por lo tanto mejora la eficiencia de nuestro programa.&lt;br /&gt;
Saludos!&lt;/p&gt;
</description>
 <pubDate>Wed, 02 Aug 2006 14:28:52 -0700</pubDate>
 <dc:creator>Lejinad</dc:creator>
 <guid isPermaLink="false">comment 47901 at http://php.apsique.com</guid>
</item>
<item>
 <title>Que buena</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comment-15042</link>
 <description>&lt;p&gt;Me gusta cuando artículos tan chicos como este tienen acogida. Creo que le daré su tiempo al tema de los thumbnails.&lt;br /&gt;
Les advierto: incluiré convert como una buena alternativa :P&lt;/p&gt;
</description>
 <pubDate>Mon, 19 Dec 2005 21:30:14 -0800</pubDate>
 <dc:creator>clbustos</dc:creator>
 <guid isPermaLink="false">comment 15042 at http://php.apsique.com</guid>
</item>
<item>
 <title>Excelente artículo</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comment-15041</link>
 <description>&lt;p&gt;Excelente artículo (chiquiti, sencillo pero presciso) jejeje. Lo he agregado a mi sabrosus.&lt;/p&gt;
</description>
 <pubDate>Mon, 19 Dec 2005 15:07:37 -0800</pubDate>
 <dc:creator>Victor</dc:creator>
 <guid isPermaLink="false">comment 15041 at http://php.apsique.com</guid>
</item>
<item>
 <title>Excelente :D</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comment-14947</link>
 <description>&lt;p&gt;Excelente man, la verdad es que pase casi dos dias quebrandome la cabeza con eso, ahorita tome el camino de los &quot;radio&quot;, pero mas adelante necesitare &quot;checkbox&quot; asi que gracias por el articulo :)&lt;/p&gt;
</description>
 <pubDate>Wed, 14 Dec 2005 23:43:39 -0800</pubDate>
 <dc:creator>Stan</dc:creator>
 <guid isPermaLink="false">comment 14947 at http://php.apsique.com</guid>
</item>
<item>
 <title>Insertando datos en la base de datos usando campos de texto y checkbox</title>
 <link>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox</link>
 <description>&lt;p&gt;A petición de algunos interesados, pongo a disposición un pequeño ejemplo de como ingresar datos a una base de datos con PHP, utilizando campos de texto y checkbox.&lt;/p&gt;
&lt;p&gt;Para usar los cuadros de verificación, no hay mayor secreto. Lo que se debe hacer es crear una secuencia como la que sigue&lt;/p&gt;
&lt;div class=&#039;code&#039;&gt;&lt;div class=&quot;hl-main&quot;&gt;&lt;ol class=&quot;hl-main&quot;&gt;&lt;li&gt;&amp;nbsp;&lt;span class=&quot;hl-inlinetags&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$aDatos&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;Primero&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;hl-number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;Segundo&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;hl-number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;Tercero&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$aDatos&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$nombre&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;lt;input type=&#039;checkbox&#039; name=&#039;seleccion[]&#039; value=&#039;&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&#039; /&amp;gt;&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$nombre&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt; &amp;lt;br /&amp;gt;&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-inlinetags&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Como se darán cuenta, la idea es crear un array (en este caso llamado seleccion), que tendrá en su interior los valores de los casilleros seleccionados.&lt;/p&gt;
&lt;p&gt;Si envíamos el formulario por POST, recibiriamos los valores de la selección en   &lt;code&gt;$_POST[&#039;seleccion&#039;]&lt;/code&gt;. Para navegar los valores, bastaría hacer un ciclo por cada uno de ellos y realizar la inserción correspondiente
&lt;div class=&#039;code&#039;&gt;&lt;div class=&quot;hl-main&quot;&gt;&lt;ol class=&quot;hl-main&quot;&gt;&lt;li&gt;&amp;nbsp;&lt;span class=&quot;hl-inlinetags&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$id_persona&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;hl-number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;; &lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt; para este ejemplo, la persona a la cual le serán asignados los valores de &amp;quot;seleccion&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;seleccion&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$seleccion&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;INSERT INTO persona_seleccion (id_persona,id_item) VALUES (?,?)&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$id_persona&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;$seleccion&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-inlinetags&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Eso sería todo. El &lt;a href=&#039;files/insercion_php.tgz&#039;&gt;ejemplo&lt;/a&gt; que presento es un tanto distinto a este, pero tiene la misma lógica. Cualquier duda, en los comentarios.
</description>
 <comments>http://php.apsique.com/contenido/insertando_datos_base_datos_usando_campos_texto_y_checkbox#comments</comments>
 <category domain="http://php.apsique.com/lenguajes/php">PHP</category>
 <category domain="http://php.apsique.com/categoria/temas_generales/programacion">Programación</category>
 <category domain="http://php.apsique.com/lenguajes/sql">SQL</category>
 <enclosure url="http://php.apsique.com/files/insercion_php.tgz" length="1218" type="application/x-gtar" />
 <pubDate>Wed, 14 Dec 2005 08:06:35 -0800</pubDate>
 <dc:creator>clbustos</dc:creator>
 <guid isPermaLink="false">533 at http://php.apsique.com</guid>
</item>
</channel>
</rss>
