Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/07/2010, 14:12
r0xdrig0
 
Fecha de Ingreso: diciembre-2007
Mensajes: 385
Antigüedad: 16 años, 4 meses
Puntos: 0
Boton Submit toma valor NULL y no deja compararlo con su valor original

Hola amigos les cuento estoy haciendo un sistema de votacion de fotos las cuales las busco por nombre y al aparecer la foto q busco abajito de la foto debe aparecer un boton con el nombre Votar he aqui mi problema y es q al hacer click en votar se me debe acumular ese voto para la foto pero el problema es q dicho boton Votar solo me toma el valor NULL lo q no me permite hacer la comparacion en el if para q me haga la actualizacion de votos y me sume el nuevo voto agregado, este es mi codigo:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
$link 
mysql_connect('localhost''root''yo2bik');
if (!
$link)
   die(
'Error al conectarse con MySQL: ' mysql_error().' <br>Número del error: '.mysql_errno());
if (! @
mysql_select_db("pintatumundoagatha",$link)){
   echo 
"No se pudo conectar correctamente con la Base de datos";
   exit();
}
?>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>

   <br />
   <form id="busca_imagenes" name="busca_imagenes" method="post" action="">
   <fieldset>
  <table width="200" border="0" align="center">
      <tr>
        <td>Nombre Artista</td>
        <td><input type="text" name="nombre_artista" id="nombre_artista" /></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>Colegio</td>
        <td><label for="colegio_artista"></label>
          <input type="text" name="colegio_artista" id="colegio_artista" /></td>
        <td><input type="submit" name="Buscar" id="Buscar" value="Buscar" /></td>
      </tr>
      <tr>
        <td>Curso</td>
        <td><label for="curso_artista"></label>
          <input type="text" name="curso_artista" id="curso_artista" /></td>
        <td>&nbsp;</td>
      </tr>
  </table>
  </fieldset>


<?php

if ($_POST['Buscar'])
{
    
        if (
$_POST['nombre_artista'])
    {
        
$buscar_nombre_artista="select artista.*, pinturas.* from artista, pinturas where artista.id_artista=pinturas.id_artista and artista.nombre_artista='".$_POST['nombre_artista']."' and pinturas.id_artista=artista.id_artista";
        
        
$buscar_nombre_artista mysql_query($buscar_nombre_artista) or die(mysql_error());
                while(
$row=mysql_fetch_assoc($buscar_nombre_artista))
                {
                    echo 
"<form id='imagenes' name='imagenes' method='post' action=''>";
                    echo 
'<center><img src="'.$row['PINTURA_URL'].'"></img></center>';
                    echo 
'<center>Nombre: '.$row['NOMBRE_ARTISTA'].'</center>';
                    echo 
'<center>Curso: '.$row['CURSO_ARTISTA'].'</center>';
                    echo 
'<center>Colegio: '.$row['COLEGIO_ARTISTA'].'</center>';
                    
//echo "<center><input type='Submit' name='Algo' value='Algo' /></center>";
                    
?>
                   <center> <input type="submit" name="Votar" value="Votar"/></center>
                    <?php
                    print_r
($_POST["Votar"]);

                    echo 
"</form>";
                    
//var_dump($row);
                    
$_SESSION['id_pintura']=$row['ID_PINTURA'];
                }
                
                
$ide_pintura $_SESSION['id_pintura'];
                
                echo 
$consulta "SELECT voto FROM votacion WHERE id_pintura='".$ide_pintura."'"
    
$consulta mysql_query($consulta); 
    
$lado=mysql_num_rows($consulta);
    while(
$row_voto mysql_fetch_array($consulta)){ 
        
$votos$row_voto['voto'];
        echo 
$votos;
        
var_dump ($Votar);
                                
                                
    }

                
                 if((
$_POST['Votar'])=="Votar")
                {
                    
//header('Location: res.php');
                    
?>
<SCRIPT LANGUAGE="javascript">
       alert('Gracias por Votar');
                                                    
   </SCRIPT>
    <?php
                    
                    $votos 
$votos 1;
// actualizo la base de datos
    
echo $consulta "UPDATE votacion SET voto = '".$votos."' WHERE id_pintura='".$ide_pintura."'";
    
mysql_query($consulta,$link);

                }
        
    }
    
    
}
?>
</form>
</body>
</html>
en este if(($_POST['Votar'])=="Votar") debe entrar para actualizarme y sumarle el voto nuevo pero no se pq el boton Votar me toma el valor NULL por lo q no entra de ninguna forma a ese if ... como lo puedo hacer amigos para q me tome el valor q le doy y q no me tome el valor NULL???? porfavor agradeceria muchisimko su ayuda amigos!!!!