Foros del Web » Programando para Internet » PHP »

Mas de un valor en un checkbox

Estas en el tema de Mas de un valor en un checkbox en el foro de PHP en Foros del Web. Hola. Estoy haciendo una página y necesito pasar mas de un parámetro en un checkbox; ¿hay alguna manera de hacerlo? Gracias...
  #1 (permalink)  
Antiguo 12/08/2006, 14:07
 
Fecha de Ingreso: diciembre-2005
Mensajes: 29
Antigüedad: 18 años, 4 meses
Puntos: 0
Pregunta Mas de un valor en un checkbox

Hola. Estoy haciendo una página y necesito pasar mas de un parámetro en un checkbox;

¿hay alguna manera de hacerlo? Gracias
  #2 (permalink)  
Antiguo 12/08/2006, 15:07
 
Fecha de Ingreso: diciembre-2005
Mensajes: 29
Antigüedad: 18 años, 4 meses
Puntos: 0
Hola de nuevo, he leido por ahí, que se puede encadenar los valores con un separador y después separarlos con un split o un explode:

Pero no se nada de PHP, y no se como tengo que hacer para que funcione.

Código PHP:
<input type="checkbox" name="nombre" value="a|b" >


En PHP:


$variables=explode("|",$_POST["nombre"]);

Tendrás:

$variables[0]="a"
$variables[1]="b"

Se pueden encadenar tantos valores como quieras.


El equivalente en JavaScript sería:

var 
variables nombre.split(" "); 
  #3 (permalink)  
Antiguo 12/08/2006, 15:09
 
Fecha de Ingreso: diciembre-2005
Mensajes: 29
Antigüedad: 18 años, 4 meses
Puntos: 0
Éste es el código del formulario.


Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<html>

<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<
meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<
meta name="ProgId" content="FrontPage.Editor.Document">
<
title>validatodoeste</title>

<
script
     
        function 
valida_envia(){
        
        var 
cuentaChecked=0;
        for(var 
i=0;i<fvalida.elements.length;i++) {
        if(
fvalida.elements[i].checked) {
        
cuentaChecked+=1;
        }
        }
        if(
cuentaChecked == 0) {
        
window.alert("Por favor Seleccione al menos un vehiculo");
        
document.fvalida.todos.focus()
        return 
false;
        }

        
//valido el Email
    
if (document.fvalida.Email.value.indexOf('@')== -1){
          
alert("Por favor Escriba su E-Mail Correcto")
       
document.fvalida.Email.focus()
       return 
0
        }
        
        
//el formulario se envia 
        
alert("Muchas gracias por enviar el formulario");
        
document.fvalida.submit();
        }

    
</script>

</head>

<body topmargin="0" leftmargin="0">

<form name="fvalida" method="POST" action="contactform2.php">
  <input type="hidden" name="rec_mailto" value="[email protected]"><input type="hidden" name="rec_subject" value="Nueva Solicitud desde su Formulario"><input type="hidden" name="rec_thanks" value="thanks.php">
  <table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>
      <td width="100%" align="left" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        1.- Datos del la Solicitud:&nbsp;&nbsp;</font></td>
    </tr>
    <tr>
      <td width="29%" align="right"></td>
      <td width="71%"></td>
    </tr>
    <tr>
      <td width="100%" align="center" colspan="2">
        <p align="center"><font size="3">Elija el Vehículo</font></p>
      </td>
    </tr>
    <tr>
      <td width="100%" align="center" colspan="2"></td>
    </tr>
    <tr>
      <td width="100%" align="center" colspan="2">
        <p align="center"><font size="2">&nbsp;&quot;Para Elegir Todas marque
        Aquí&quot; <input type="checkbox" onclick="marcar(this)" value="0" name="todos">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        El total es:&nbsp; <input type="text" name="total" size="9"></font></p>
      </td>
    </tr>
    <tr>
      <td width="100%" align="center" colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td width="100%" align="center" colspan="2">
      <script language="JavaScript" type="text/javascript">
var c=new Array("Mercedes","Renault","Citroen","Volvo","Ford");

function marcar(check){
for(z=0;z<c.length;z++){
document.forms[0][c[z]].checked=check.checked;

calcular();
}

function calcular(){
tt=0;
for(z=0;z<c.length;z++){
tt+=(document.forms[0][c[z]].checked)?parseFloat(document.forms[0][c[z]].value):0;
}
document.forms[0]['total'].value=formatCurrency(tt);
}

function formatCurrency(num)
{
num = num.toString().replace(/\€|\,/g,'');
if(isNaN(num)) 
num = "0";
cents = Math.floor((num*100+0.5)%100);
num = Math.floor((num*100+0.5)/100).toString();
if(cents < 10) 
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+'.'+num.substring(num.length-(4*i+3));
return (num + "," + cents+ " €" );
}
</script>
        <div align="center">
          <center>
          <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <td width="107" align="center"></td>
              <td width="107" align="center">
                <p align="left"><font size="2"><input type="checkbox" name="Mercedes" value="10.20" onclick="calcular()">Mercedes</font>
              <td width="108" align="center">
                <p align="left"><font size="2"><input type="checkbox" name="Renault" value="10.20" onclick="calcular()">Renault</font>
              <td width="108" align="center">
                <p align="left"><font size="2"><input type="checkbox" name="Citroen" value="10.20" onclick="calcular()">Citroen</font>
              <td width="108" align="center">
                <p align="left"><font size="2"><input type="checkbox" name="Volvo" value="10.20" onclick="calcular()">Volvo</font>
              <td width="108" align="center">
                <p align="left"><font size="2"><input type="checkbox" name="Ford" value="10.20" onclick="calcular()">Ford</font></td>
              <td width="108" align="center"></td>
            </tr>
            <tr>
              <td width="754" align="center" colspan="7"></td>
            </tr>
            <tr>
              <td width="100%" align="center" colspan="7">
                <hr color="#002F5E" align="center">
              </td>
            </tr>
          </center>
          <tr>
            <td width="100%" align="center" colspan="7">
              <p align="left"></td>
          </tr>
          </table>
        </div>
      </td>
    </tr>
    <tr>
      <td width="29%" align="right"><font size="2">Nombre o Razón Social:&nbsp;</font></td>
      <td width="71%"><font size="2"><input name="Nombre" type="text" size="35"></font></td>
    </tr>
    <tr>
      <td width="29%" align="right"></td>
      <td width="71%"></td>
    </tr>
    <tr>
      <td width="29%" align="right"><font size="2">Teléfonos de Contacto:&nbsp;</font></td>
      <td width="71%"><font size="2"><input name="Telefono" type="text" size="10" maxlength="9">
        - </font><font size="2">Email: </font><font size="2"><input name="Email" type="text" size="30"></font><span class="producto_dato"><font size="2">&nbsp;</font></span></td>
    </tr>
    <tr>
      <td width="29%" align="right"></td>
      <td width="71%"></td>
    </tr>
    <tr>
      <td width="29%" align="right"></td>
      <td width="71%">
        <p align="left"><font size="2">Descripción de productos y servicios:</font></p>
      </td>
    </tr>
    <tr>
      <td width="29%" align="right"></td>
      <td width="71%"><font size="2"><textarea name="Texto" cols="35" rows="5"></textarea></font></td>
    </tr>
    <tr>
      <td width="29%" align="right"></td>
      <td width="71%"></td>
    </tr>
  </table>
  <p align="center"><font face="Arial" size="2" color="#336699"><b><input type="button" name="Submit" value="Enviar" onclick="valida_envia()"></b></font></p>
</form>

</body> 
  #4 (permalink)  
Antiguo 12/08/2006, 15:30
 
Fecha de Ingreso: diciembre-2005
Mensajes: 29
Antigüedad: 18 años, 4 meses
Puntos: 0
Éste es el scrip PHP, que recoge los datos del formulario.

Como es muy largo lo he dividido en 2 partes.

1ª Parte

Código PHP:
<?

// ##########################################################################
// ##########################################################################
//
//  
$from_address "[email protected]";

// ###########################################################################
// ###########################################################################





// ###########################################################################
// #### ACTIVATE REQUIRED FIELDS? ############################################

// THIS AREA IS OPTIONAL. ONLY TOUCH THESE SETTINGS IF YOU KNOW WHAT YOU ARE
// DOING. PLEASE READ README.TXT FOR MORE INFORMATION.
//
// If you would like to make some fields of your form required, change "no" to
// "yes" below.

$required_on "yes";

// If you have set $required_on to "yes" above, you can make fields required
// by beginning their name with "r_". For example, if you want to require
// a user to enter their name, use the following HTML:
//
// <input type='text' name='r_Name'>
//
// If a user fails to enter a required field, they will be taken to a page
// where a message such as "You have not completed all the required fields."
// will be displayed. Please specify the URL to this file below:

$required_errorpage "error.php";

// ###########################################################################
// ###########################################################################





// ###########################################################################
// #### OVERRIDE REQUIRED VARIABLES? #########################################

// THIS AREA IS OPTIONAL. ONLY TOUCH THESE SETTINGS IF YOU KNOW WHAT YOU ARE
// DOING. PLEASE READ README.TXT FOR MORE INFORMATION. NOTE: THIS WILL NOT
// AFFECT YOUR 'TURN ON REQUIRED FIELDS?' SECTION SETTINGS ABOVE.
//
// If you would like to override the three required variables in
// order to hide your email address, email subject, and thank you page
// URL from your email form, change "no" to "yes" below.

$override "no";

// If override is set to "yes", the hidden variables on your HTML
// email form named "rec_mailto", "rec_subject", and "rec_thanks" will be
// overridden and can therefore be removed from the form.

// If you have set override to "yes" above, you must specify new values for
// each of these variables below.

// Enter the email address(es) to send the email to.
$incoming_mailto "[email protected]";

// Enter the email subject.
$incoming_subject "Tiene un nuevo mensaje desde Su Formulario";

// Enter the thank you page URL.
$incoming_thanks "thanks.php";

// ###########################################################################
// ###########################################################################





// ###########################################################################
// #### BAN IP ADDRESSES? ####################################################

// THIS AREA IS OPTIONAL. ONLY TOUCH THESE SETTINGS IF YOU KNOW WHAT YOU ARE
// DOING. PLEASE READ README.TXT FOR MORE INFORMATION.
//
// If you would like to ban certain IP addresses from submitting your form,
// change "no" to "yes" below.

$ban_ip_on "no";

// If you have set $ban_ip_on to "yes" above, please enter a list of the
// IP addresses you would like to ban, seperated only by commas.
// An example has been provided below:

$ban_ip_list "111.222.33.55,11.33.777.99";

// ###########################################################################
// ###########################################################################





// ###########################################################################
// #### ACTIVATE DOMAIN SECURITY? ############################################
//

$secure_domain_on "yes";

// ###########################################################################
// ###########################################################################
  #5 (permalink)  
Antiguo 12/08/2006, 15:31
 
Fecha de Ingreso: diciembre-2005
Mensajes: 29
Antigüedad: 18 años, 4 meses
Puntos: 0
2ª Parte

Código PHP:
// ###########################################################################
// #### ACTIVATE AUTO-RESPONSE? ##############################################
//

$autorespond_on "yes";

// If you have set $autorespond_on to "yes" above, you must specify a subject,
// from-address, and message to include in the auto-response email.

// The following setting is the subject of the auto-response email:
$autorespond_subject "Info!";

// The following setting is the from-address of the auto-respond email:
$autorespond_from "[email protected]";

// The following setting is the message of your auto-response email:
$autorespond_contents "Estimado/a Sr. Sra: $Nombre, Gracias por su solicitud  

La suma total es: $total
  
Acontinuación le enviamos sus datos que nos ha enviado, guarde este mensaje pues le puede necesitar para contactar con nuestra Empresa y para modificar sus datos. 

------------------------
1.- Datos: 
------------------------
Nombres de los Vehículos: $Mercedes $Renault $Citroen $Volvo $Ford


------------------------
Nombre o Razón Social: $Nombre

------------------------
Telefono de Contacto: $Telefono

------------------------
Email: $Email

------------------------
Descripción de Producto o Servicio: 
$Texto

*************************
Gracias"
;

// DynaForm also needs to know how to retrieve the user's email address.
// You must specify the name of the field into which the user will enter
// their email address. For example, if your email form contains an input
// field like "<input type='text' name='Email'>" you would set the
// following setting to "Email".
$autorespond_mailto_field "Email";

// ###########################################################################
// ###########################################################################










// MAKE SURE DYNAFORM IS NOT BEING LOADED FROM THE URL
if($HTTP_SERVER_VARS['REQUEST_METHOD'] == "GET") {
echo 
"
<html>
<head><title>Contact PHP Form is installed correctly.</title></head>
<body>
<font style='font-family: verdana, arial; font-size: 9pt;'>
<b>Contact Form is installed correctly.</b></font><br>
<font style='font-family: verdana, arial; font-size: 8pt;'>
Form Easy PHP Form Mailer.
</font>
</body></html>
"
;
exit();
}

// SET VARIABLES
$incoming_fields array_keys($HTTP_POST_VARS);
$incoming_values array_values($HTTP_POST_VARS);


if(
$override == "no") {
$incoming_mailto = @$HTTP_POST_VARS['rec_mailto'];
$incoming_subject = @$HTTP_POST_VARS['rec_subject'];
$incoming_thanks = @$HTTP_POST_VARS['rec_thanks'];
}

$incoming_mailto_cc = @$HTTP_POST_VARS['opt_mailto_cc'];
$incoming_mailto_bcc = @$HTTP_POST_VARS['opt_mailto_bcc'];
$form_url = @$HTTP_REFERER;

// MAKE SURE DYNAFORM IS BEING RUN FROM THE RIGHT DOMAIN
if($secure_domain_on == "yes") {
$form_url_array parse_url($form_url);
$form_domain $form_url_array[host];
if(
$form_domain != $HTTP_SERVER_VARS[HTTP_HOST]) {
echo 
"<h2>Form Error - Invalid Domain</h2>
You have accessed Form from an external domain - this is not allowed.<br>
You may only submit forms to a Form file that exists on the same domain name.<br>
If you believe to be receiving this message in error, please refer to your readme.txt file.
<br><br>"
;
$error "yes";
}
}

// CHECK IF MAILTO IS SET
if($incoming_mailto == "") {
echo 
"<h2>Form Error - Missing Field</h2>
Your form located at <a href='$form_url'>$form_url</a> does not work because you forgot to include
the required \"<b>rec_mailto</b>\" field within the form. This field specifies who the email will
be sent to.
<br><br>
This should look like:<br>
<input type=\"hidden\" name=\"rec_mailto\" value=\"[email protected]\">
<br><br>
If you are still confused, please refer to the readme.txt for more information and examples.<br><br><br><br>
"
;
$error "yes";
}

// CHECK IF SUBJECT IS SET
if($incoming_subject == "") {
echo 
"<h2>Form Error - Missing Field</h2>
Your form located at <a href='$form_url'>$form_url</a> does not work because you forgot to include
the required \"<b>rec_subject</b>\" field within the form. This field specifies the subject of
the email that will be sent.
<br><br>
This should look like:<br>
<input type=\"hidden\" name=\"rec_subject\" value=\"New Form Email\">
<br><br>
If you are still confused, please refer to the readme.txt for more information and examples.<br><br><br><br>
"
;
$error "yes";
}

// CHECK IF THANKS IS SET
if($incoming_thanks == "") {
echo 
"<h2>Form Error - Missing Field</h2>
Your form located at <a href='$form_url'>$form_url</a> does not work because you forgot to include
the required \"<b>rec_thanks</b>\" field within the form. This field specifies what page the user
will be taken to after they submit the form.
<br><br>
This should look like:<br>
<input type=\"hidden\" name=\"rec_thanks\" value=\"thanks.html\">
<br><br>
If you are still confused, please refer to the readme.txt for more information and examples.<br><br><br><br>
"
;
$error "yes";
}

// CHECK IF IP ADDRESS IS BANNED
if($ban_ip_on == "yes") {

if(
strstr($ban_ip_list$HTTP_SERVER_VARS[REMOTE_ADDR])) {
echo 
"<h2>Form Error - Banned IP</h2>
You cannot use this form because your IP address has been banned by the administrator.<br>
"
;
$error "yes";
}
}


if(
$error == "yes") {
exit();
}

// SET EMAIL INTRODUCTION
$message "Este email ha sido recibido desde su web $form_url \n\n";

// LOAD EMAIL CONTENTS 
for ($i 0$i count($incoming_fields); $i++) { 
if(
$incoming_fields[$i] != "rec_mailto") {
if(
$incoming_fields[$i] != "rec_subject") {
if(
$incoming_fields[$i] != "rec_thanks") {
if(
$incoming_fields[$i] != "opt_mailto_cc") {
if(
$incoming_fields[$i] != "opt_mailto_bcc") {

// CHECK FOR REQUIRED FIELDS IF ACTIVATED
if($required_on == "yes") {
$sub substr($incoming_fields[$i], 02);
if(
$sub == "r_") {
if(
$incoming_values[$i] == "" OR !isset($incoming_values[$i]) OR $incoming_values[$i] == " ") {
header("Location: $required_errorpage");
exit();
}}}

// ADD FIELD TO OUTGOING MESSAGE
$message .= "$incoming_fields[$i]:\n$incoming_values[$i]\n\n";
}}}}}}

// SET EMAIL FOOTER
$message .= "\n\nFormulario contacto";

// CLEAR HEADERS
$headers "";

// ADD FROM ADDRESS
if($from_address != "") {
$headers .= "From: $from_address\r\n";
}

// CHECK FOR CC OR BCC
if($incoming_mailto_cc != "") {
$headers .= "Cc: $incoming_mailto_cc\r\n";
}
if(
$incoming_mailto_bcc != "") {
$headers .= "Bcc: $incoming_mailto_bcc\r\n";
}

// SEND EMAIL
mail($incoming_mailto$incoming_subject$message$headers);

// SEND AUTO-RESPONSE IF ACTIVATED
if($autorespond_on == "yes") {
$autorespond_mailto = @$HTTP_POST_VARS[$autorespond_mailto_field];
$autorespond_headers "From: $autorespond_from";
mail($autorespond_mailto$autorespond_subject$autorespond_contents$autorespond_headers);
}

// FORWARD TO THANK YOU PAGE
header("Location: $incoming_thanks"); 


?> 
  #6 (permalink)  
Antiguo 12/08/2006, 16:58
 
Fecha de Ingreso: junio-2005
Mensajes: 981
Antigüedad: 18 años, 10 meses
Puntos: 2
Creo que es mucho codigo como para revisarlo. Pero no me queda claro tu consulta. ¿Estas preguntando si esta bien hecho si pasas varios valores en un check box divididos por un caracter? Si preguntas eso, yo lo implementaria de igual forma, los paso todos juntos divididos con un | y con un simple explode los divido de nuevo.

Saludos y SUerte.
  #7 (permalink)  
Antiguo 12/08/2006, 22:55
Avatar de vevni  
Fecha de Ingreso: julio-2005
Ubicación: cancun mexico
Mensajes: 598
Antigüedad: 18 años, 9 meses
Puntos: 3
mmmmm y si los pasamos usando $modelos_autos[]
en donde con esto tendras todos los datos del checkbox en un array....
o yo estoy mal o pork tanto rollo?
__________________
Código PHP:
echo"hola mundo ver 1221332143.02";
echo
"cuantos usuarios habran impreso hola mundo en el mundo.!???"
  #8 (permalink)  
Antiguo 12/08/2006, 22:56
Avatar de vevni  
Fecha de Ingreso: julio-2005
Ubicación: cancun mexico
Mensajes: 598
Antigüedad: 18 años, 9 meses
Puntos: 3
no lei bien el post pero por lo k veo en escencia es eso, si estoy mal corrijanme... saludos esk si es mucho codigo, de verlo casi me duermo jajaja
__________________
Código PHP:
echo"hola mundo ver 1221332143.02";
echo
"cuantos usuarios habran impreso hola mundo en el mundo.!???"
  #9 (permalink)  
Antiguo 13/08/2006, 02:35
 
Fecha de Ingreso: diciembre-2005
Mensajes: 29
Antigüedad: 18 años, 4 meses
Puntos: 0
Hola, y gracias por responder.

He puesto todo el código para tratar de que se entienda bién mi pregunta.

Si nos fijamos bién, el primer código se trata de un formulario en el que el usuario debe introducir unos datos y elegir opciones de checkbox.

Estos checkbox tienen un código javascript, siendo el value de todos 10.20 €.

Una vez relleno los envía. Y el los recoge el 2º código que he puesto tan largo, y que es un archivo PHP.

¿Que hace este 2º archivo? Pues me envía a mi un correo e-mail, con todos los datos del visitante, y además le devuelve a la persona, otro e-mail confirmando los datos que ha introducido.

Creo que está claro.

Lo he probado y el e-mail que me envía a mi está perfecto, pero el e.mail que devuelve al visitante tiene un fallo, y es que en el campo de los nombres de los vehículos elegidos, le devuelve, 10.20 10.20 etc.

Es decir, le devuelve los values de los checkbox marcados.

Yo lo que quiero hacer es que en lugar de que le envíe el valor 10.20 10.20 etc. le diga los nombres de estos vehículos, por ejemp. Mercedes, Citroen, Volvo, tec.

Espero haberme explicado, y ojalá alguien pueda ayudarme,

Un saludo y muchas gracias a todos.
  #10 (permalink)  
Antiguo 14/08/2006, 07:49
Avatar de fatherjuan  
Fecha de Ingreso: mayo-2005
Ubicación: Estado de México
Mensajes: 132
Antigüedad: 18 años, 10 meses
Puntos: 0
No se si esto es lo que busques, pero puedes hacer un arreglo de checkboxes y recogerlo con un $_POST

Código HTML:
</div>
              <td bgcolor="#FFFFFF"> <div align="left"> 
                  <table width="380" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="15"><font size="2" face="Arial, Helvetica, sans-serif"> 
                        <input name="sport[0]" type="checkbox" id="sport[0]" value="aut">
                        </font></td>
                      <td width="70"><font color="#003399" size="2" face="Arial, Helvetica, sans-serif">Autos</font></td>
                      <td width="15"><font size="2" face="Arial, Helvetica, sans-serif"> 
                        <input name="sport[1]" type="checkbox" id="sport[1]" value="bsk">
                        </font></td>
                      <td width="80"> <p><font color="#003399" size="2" face="Arial, Helvetica, sans-serif">Basketball</font></p></td>
                      <td width="15"><font size="2" face="Arial, Helvetica, sans-serif"> 
                        <input name="sport[2]" type="checkbox" id="sport[2]" value="bbl">
                        </font></td>
                      <td width="70"><font color="#003399" size="2" face="Arial, Helvetica, sans-serif">Baseball</font></td>
                      <td width="15"><font size="2" face="Arial, Helvetica, sans-serif"> 
                        <input name="sport[3]" type="checkbox" id="sport[3]" value="box">
                        </font></td>
                      <td width="70"><font color="#003399" size="2" face="Arial, Helvetica, sans-serif">Box</font></td>
                    </tr>
                    <tr> 
                      <td><font size="2" face="Arial, Helvetica, sans-serif"> 
                        <input name="sport[4]" type="checkbox" id="sport[4]" value="cab">
                        </font></td>
                      <td><font color="#003399" size="2" face="Arial, Helvetica, sans-serif">Caballos</font></td>
                      <td><font size="2" face="Arial, Helvetica, sans-serif"> 
                        <input name="sport[5]" type="checkbox" id="sport[5]" value="cic">
                        </font></td>
                      <td><font color="#003399" size="2" face="Arial, Helvetica, sans-serif">Ciclismo</font></td>
                      <td><font size="2" face="Arial, Helvetica, sans-serif"> 
                        <input name="sport[6]" type="checkbox" id="sport[6]" value="glf">
                        </font></td>
                      <td><font color="#003399" size="2" face="Arial, Helvetica, sans-serif">Golf</font></td>
                      <td><font size="2" face="Arial, Helvetica, sans-serif"> 
                        <input name="sport[7]" type="checkbox" id="sport[7]" value="hck">
                        </font></td>
                      <td><font color="#003399" size="2" face="Arial, Helvetica, sans-serif">Hockey</font></td>
                    </tr>
                    <tr> 
                      <td><font size="2" face="Arial, Helvetica, sans-serif"> 
                        <input name="sport[8]" type="checkbox" id="sport[8]" value="nfl">
                        </font></td>
                      <td><font color="#003399" size="2" face="Arial, Helvetica, sans-serif">NFL</font></td>
                      <td><font size="2" face="Arial, Helvetica, sans-serif"> 
                        <input name="sport[9]" type="checkbox" id="sport[9]" value="rug">
                        </font></td>
                      <td><font color="#003399" size="2" face="Arial, Helvetica, sans-serif">Rugby</font></td>
                      <td><font size="2" face="Arial, Helvetica, sans-serif"> 
                        <input name="sport[10]" type="checkbox" id="sport[10]" value="scc">
                        </font></td>
                      <td><font color="#003399" size="2" face="Arial, Helvetica, sans-serif">Futbol 
                        Soc </font></td>
                      <td><font size="2" face="Arial, Helvetica, sans-serif"> 
                        <input name="sport[11]" type="checkbox" id="sport[11]" value="tns">
                        </font></td>
                      <td><font color="#003399" size="2" face="Arial, Helvetica, sans-serif">Tennis</font></td>
                    </tr>
                  </table>
                </div></td> 
CODIGO PHP:

Código PHP:
$sport $_POST['sport'];

$deporte implode" " $sport); 
ESTO TE CREA UN STRING CON TODOS LOS DEPORTES QUE ESTAN CHEQUEADOS, YO LO USE Y ME FUNCIONO.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:56.