Ver Mensaje Individual
  #5 (permalink)  
Antiguo 27/01/2009, 14:18
olivieta
 
Fecha de Ingreso: diciembre-2008
Mensajes: 11
Antigüedad: 15 años, 5 meses
Puntos: 1
Respuesta: Guardar seleccion de checkbox dinamico

Mil gracias, lei el manual que me pasaste... alli encontre la respuesta a lo que ando buscando
Código PHP:
<?
$conexio 
mysql_connect("localhost","usuario","clave");
mysql_select_db ("DB"$conexio) OR die ("No se puede conectar  a DB");
$proSQL "SELECT * FROM tabla ORDER BY campo"//selecting products from DB
$pro_query mysql_query($proSQL) or die($proSQL."<br>".mysql_error());
$pro_num mysql_num_rows($pro_query); //number of products

print("<form action='theend.php' method='post'>");

$i=0;
while(
$products mysql_fetch_object($pro_query)){
$i++;
print 
$i;
print(
"<input type='checkbox' name='$i' value='$tabla->campo'> $tabla->campo <br>"); //print a checkbox with the product name

}
print(
"<input type='hidden' value='$pro_num' name='products_number'>");//number of products
print("<input type='submit'></form>");
?>

<?
$i
=0;
while(
$i $products_number){
$i++;
if($
$i){
$message .="$$i<br>";
}
}
print(
"$message");//a list of checked products

?>
Esto le dará una lista de los productos seleccionados por el usuario.
Normalmente lo utilizan para enviar por e-mail con otras informaciones recogidas de la forma.

This will give a list of the products selected by the user.
I usually use it to send by e-mail with other informations collected from the form.