Ver Mensaje Individual
  #8 (permalink)  
Antiguo 21/08/2009, 13:15
Avatar de salvador86
salvador86
 
Fecha de Ingreso: enero-2008
Ubicación: Guadalajara- Mexico
Mensajes: 467
Antigüedad: 16 años, 4 meses
Puntos: 2
Respuesta: Gestionar radio button con Php

Sea que haya seleccionado Femenino o Masculino siempre me bota el valor de masculino
Código HTML:
Male<input name="Sex" type="radio" id="Sex" value="Male">
Female<input name="Sex" type="radio" id="Sex" value="Female" checked> 
mi php
Código PHP:
if(isset($_POST['Submit']) and $capt->check_result()){        
    
$message_send "Message from the web<br><br>      
    Name: "
.utf8_decode($_POST['Name'])." <br>
    E-mail: "
.utf8_decode($_POST['Email'])." <br>
    Sex: "
.utf8_decode($_POST['Sex'])." <br>//Esta el envio de genero
    Questions: "
.utf8_decode($_POST['Questions'])." <br>";
    foreach (
$_POST['Tour'] as $id){
    
$message_send $message_send "Tour :" utf8_decode($id) . "<br>";
} ...] 
Pero antes de recoger la informacion el formulario hace una validación en un js (se valida por un captcha)
Código PHP:
function get(obj) {
      var 
poststr "Name=" encodeURI(  
      
document.getElementById("Name").value ) +
      
"&Email=" encodeURIdocument.getElementById("Email").value )+
      
"&Sex=" encodeURIdocument.getElementById("Sex").value )+
      
"&Questions=" encodeURIdocument.getElementById("Questions").value )+
      
"&capt=" encodeURIdocument.getElementById("capt").value )+              
      
"&Submit=" encodeURIdocument.getElementById("Submit").value );
      for(
i=0i<=31i++){ 
              if(
document.getElementById("Tour"+i).checked
            
poststr poststr "&Tour[" "] = " encodeURI(document.getElementById("Tour"+i).value ); 
             }
      
makePOSTRequest('captcha/i-envio-solicitud.php'poststr);
   }