Foros del Web » Programando para Internet » PHP »

problemas con el submit T_T HELP

Estas en el tema de problemas con el submit T_T HELP en el foro de PHP en Foros del Web. No se que hago mal T_T cuando hago clic en el boton simplemente no hace nada y pues busco por mis medio tratar de llegar ...
  #1 (permalink)  
Antiguo 07/03/2010, 10:19
 
Fecha de Ingreso: agosto-2009
Mensajes: 110
Antigüedad: 14 años, 8 meses
Puntos: 1
problemas con el submit T_T HELP

No se que hago mal T_T cuando hago clic en el boton simplemente no hace nada y pues busco por mis medio tratar de llegar a la solución hasta que me duele la cabezita y pido ayuda a mis amigos con mas experiencia en esta web ...si le podrían echar un ojito se los agradeceria.

Código PHP:
<?php
require('Connections/db-cnx.php');

   
$not_ID $_GET['not_ID']; 
   
     
$row=mysql_fetch_array(mysql_query("select * from apuesta where id_a='".$not_ID."'"));
       
$bet1 $row['bet1'];
       
$bet2 $row['bet2'];
       
$empate $row['empate'];
       
$fec_fin $row['fec_fin'];
    
    
$fecha = new DateTime();
    
$actual $fecha->format('Y/m/d h:i:s');
//si la hora actual ya paso el tiempo final    
if($fec_fin $actual){
    
$raw=mysql_fetch_array(mysql_query("select * from detalle_a where id_a='".$not_ID."'"));
        
$cant $raw['cantidad'];
        
$id $raw['id'];
        
        if(
$_POST['submit']=='Pagar')
        {
            
$gano $_POST['radio'];

            if(
$gano == "local")
            {
            
$win floor(((($bet2+$empate)/$bet1)*$cant)+$cant);
            
$q "update tz_members set puntos = puntos + ".$win." where id='".$id."' and apuesta = 'local'"
                
mysql_query($q) or die(mysql_error());
            }
            if(
$gano == "visita")
            {
            
$win floor(((($bet1+$empate)/$bet2)*$cant)+$cant);
            
$q "update tz_members set puntos = puntos + ".$win." where id='".$id."' and apuesta = 'visita'"
                
mysql_query($q) or die(mysql_error());
            }
            if(
$gano == "empate")
            {
            
$win floor(((($bet1+bet2)/$empate)*$cant)+$cant);
            
$q "update tz_members set puntos = puntos + ".$win." where id='".$id."' and apuesta = 'empate'"
                
mysql_query($q) or die(mysql_error());
            }
            
            
            
$qq "update apuesta set estado = 1 where id_a='".$not_ID."'"
                
mysql_query($qq) or die(mysql_error());
            
$qqq "update detalle_a set ganancia = ".$win." where id_a='".$not_ID."' and id='".$id."'"
                
mysql_query($qqq) or die(mysql_error());
                
                echo 
"<script> alert (\"Las Apuestas fueron Pagadas.\"); </script>";
                echo 
"<script language=Javascript> location.href=\"panel_apuesta.php\"; </script>";
            
            }
        
?>
        <form action="" method="post">
        <input type="radio" name="radio" value="local" /><?php echo $row['equipo1']; ?><br />
        <input type="radio" name="radio" value="visita" /><?php echo $row['equipo2']; ?><br />
        <input type="radio" name="radio" value="empate" /> EMPATE !<br />
        <input type="submit" name="submit" value="Pagar" />
        </form>
<?php
}else 
echo 
"Todavia no finaliza el Partido";


?>
  #2 (permalink)  
Antiguo 07/03/2010, 10:30
Avatar de Mahishasura  
Fecha de Ingreso: enero-2010
Ubicación: En las profundidades del cosmos
Mensajes: 58
Antigüedad: 14 años, 3 meses
Puntos: 4
Respuesta: problemas con el submit T_T HELP

El formulario no tiene ni una acción, podrías cambiar la recepción del formulario por algo así...
Código HTML:
Ver original
  1. <form action="?do=pagar" method="post">
  2.         <input type="radio" name="radio" value="local" /><?php echo $row['equipo1']; ?><br />
  3.         <input type="radio" name="radio" value="visita" /><?php echo $row['equipo2']; ?><br />
  4.         <input type="radio" name="radio" value="empate" /> EMPATE !<br />
  5.         <input type="submit" name="submit" value="Pagar" />
  6. </form>
Código PHP:
Ver original
  1. //........
  2. if($_GET['do']=='pagar'){
  3.             $gano = $_POST['radio'];
  4.  
  5.             if($gano == "local")
  6. //........

Saludos
  #3 (permalink)  
Antiguo 07/03/2010, 10:37
 
Fecha de Ingreso: agosto-2009
Mensajes: 110
Antigüedad: 14 años, 8 meses
Puntos: 1
Respuesta: problemas con el submit T_T HELP

:o ... oki lo intentare, gracias!
  #4 (permalink)  
Antiguo 07/03/2010, 11:25
 
Fecha de Ingreso: agosto-2009
Mensajes: 110
Antigüedad: 14 años, 8 meses
Puntos: 1
Respuesta: problemas con el submit T_T HELP

=( hice lo que recomendaste y nada waaaa!!!!

Código PHP:
<?php
require('Connections/db-cnx.php');

   
$not_ID $_GET['not_ID']; 
   
     
$row=mysql_fetch_array(mysql_query("select * from apuesta where id_a='".$not_ID."'"));
       
$bet1 $row['bet1'];
       
$bet2 $row['bet2'];
       
$empate $row['empate'];
       
$fec_fin $row['fec_fin'];
    
    
$fecha = new DateTime();
    
$actual $fecha->format('Y/m/d h:i:s');
//si la hora actual ya paso el tiempo final    
if($fec_fin $actual){
    
$raw=mysql_fetch_array(mysql_query("select * from detalle_a where id_a='".$not_ID."'"));
        
$cant $raw['cantidad'];
        
$id $raw['id'];
        
        if(
$_GET['do']=='pagar')
        {
            
$gano $_POST['radio'];

            if(
$gano == "local")
            {
            
$win floor(((($bet2+$empate)/$bet1)*$cant)+$cant);
            
$q "update tz_members set puntos = puntos + ".$win." where id='".$id."' and apuesta = 'local'"
                
mysql_query($q) or die(mysql_error());
            }
            if(
$gano == "visita")
            {
            
$win floor(((($bet1+$empate)/$bet2)*$cant)+$cant);
            
$q "update tz_members set puntos = puntos + ".$win." where id='".$id."' and apuesta = 'visita'"
                
mysql_query($q) or die(mysql_error());
            }
            if(
$gano == "empate")
            {
            
$win floor(((($bet1+bet2)/$empate)*$cant)+$cant);
            
$q "update tz_members set puntos = puntos + ".$win." where id='".$id."' and apuesta = 'empate'"
                
mysql_query($q) or die(mysql_error());
            }
            
            
            
$qq "update apuesta set estado = 1 where id_a='".$not_ID."'"
                
mysql_query($qq) or die(mysql_error());
            
$qqq "update detalle_a set ganancia = ".$win." where id_a='".$not_ID."' and id='".$id."'"
                
mysql_query($qqq) or die(mysql_error());
                
                echo 
"<script> alert (\"Las Apuestas fueron Pagadas.\"); </script>";
                echo 
"<script language=Javascript> location.href=\"panel_apuesta.php\"; </script>";
            
            }
        
?>
        <form action="?do=pagar" method="post">
        <input type="radio" name="radio" value="local" /><?php echo $row['equipo1']; ?><br />
        <input type="radio" name="radio" value="visita" /><?php echo $row['equipo2']; ?><br />
        <input type="radio" name="radio" value="empate" /> EMPATE !<br />
        <input type="submit" name="submit" value="pagar" />
        </form>
<?php
}else 
echo 
"Todavia no finaliza el Partido";


?>
  #5 (permalink)  
Antiguo 07/03/2010, 16:29
Avatar de Mahishasura  
Fecha de Ingreso: enero-2010
Ubicación: En las profundidades del cosmos
Mensajes: 58
Antigüedad: 14 años, 3 meses
Puntos: 4
Respuesta: problemas con el submit T_T HELP

Puede que tengas un problema con la comparación de fechas...
Código PHP:
<?php
require('Connections/db-cnx.php');
    
$not_ID $_GET['not_ID']; 
   
    
$row=mysql_fetch_array(mysql_query("select * from apuesta where id_a='".$not_ID."'"));
    
$bet1 $row['bet1'];
    
$bet2 $row['bet2'];
    
$empate $row['empate'];
    
$fec_fin $row['fec_fin'];

    
$fecha_actual=strtotime(date('Y-m-d H:i:s'));
    
$fecha_final=strtotime($fec_fin);

if(
$fecha_final <= $fecha_actual){
//Si ya terminó el partido

    
$raw=mysql_fetch_array(mysql_query("select * from detalle_a where id_a='".$not_ID."'"));
    
$cant $raw['cantidad'];
    
$id $raw['id'];
        
        if(
$_GET['do']=='pagar'){
            
$gano $_POST['radio'];

            if(
$gano == "local")
            {
            
$win floor(((($bet2+$empate)/$bet1)*$cant)+$cant);
            
$q "update tz_members set puntos = puntos + ".$win." where id='".$id."' and apuesta = 'local'"
                
mysql_query($q) or die(mysql_error());
            }
            if(
$gano == "visita")
            {
            
$win floor(((($bet1+$empate)/$bet2)*$cant)+$cant);
            
$q "update tz_members set puntos = puntos + ".$win." where id='".$id."' and apuesta = 'visita'"
                
mysql_query($q) or die(mysql_error());
            }
            if(
$gano == "empate")
            {
            
$win floor(((($bet1+bet2)/$empate)*$cant)+$cant);
            
$q "update tz_members set puntos = puntos + ".$win." where id='".$id."' and apuesta = 'empate'"
                
mysql_query($q) or die(mysql_error());
            }
            
            
            
$qq "update apuesta set estado = 1 where id_a='".$not_ID."'"
                
mysql_query($qq) or die(mysql_error());
            
$qqq "update detalle_a set ganancia = ".$win." where id_a='".$not_ID."' and id='".$id."'"
                
mysql_query($qqq) or die(mysql_error());
                
                echo 
"<script> alert (\"Las Apuestas fueron Pagadas.\"); </script>";
                echo 
"<script language=Javascript> location.href=\"panel_apuesta.php\"; </script>";
            
            }
} else {
echo 
"Todavia no finaliza el Partido"; }
?>
        <form action="?do=pagar" method="post">
        <input type="radio" name="radio" value="local" /><?php echo $row['equipo1']; ?><br />
        <input type="radio" name="radio" value="visita" /><?php echo $row['equipo2']; ?><br />
        <input type="radio" name="radio" value="empate" /> EMPATE !<br />
        <input type="submit" name="submit" value="pagar" />
        </form>
Cambié el formato de la hora, de "h" a "H" Así podrás tener un cálculo mucho más preciso.
Lo que hice fue simplemente convertir la fecha actual a tiempo Unix, investiga si te interesa.
Al momento de guardar la fecha en la columna fec_fin, deberás cambiar el formato de la Hora también, por que si la dejas en "h" obtendrás 05, en cambio con "H" obtendrás 17
Saludos

Última edición por Mahishasura; 07/03/2010 a las 16:34

Etiquetas: submit
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 12:17.