Ver Mensaje Individual
  #13 (permalink)  
Antiguo 10/03/2008, 14:49
Avatar de pato12
pato12
 
Fecha de Ingreso: septiembre-2007
Ubicación: Salta
Mensajes: 1.620
Antigüedad: 16 años, 6 meses
Puntos: 101
Re: (Ayuda) Encuesta algunos errores

Prueba con esto:
Encuesta:
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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<? 
$servidor 
"localhost"
$usuario "w1070536"
$password "kuzufiSO13"
$base_de_datos "w1070536_encuesta"
$conextar=mysql_connect ($servidor,$usuario,$password); 
mysql_select_db($base_de_datos); 
$sqlupdate "UPDATE encuestas SET valor$voto = valor$voto+1, total = total+1"
mysql_query($sqlupdate,$conextar); 
$sql "SELECT * FROM encuestas ORDER BY idencuesta desc LIMIT 1"
$row mysql_fetch_array($sql); 
?> 
<script type="text/javascript" language="JavaScript"> 
function resultados(){ 
window.open("resultados.php","","toolbar=0,locatio n=0,directories=0,status=0,menubar=0,scrollbars=0, resizable=0,width=320,height=200"); 

</script> 
<form name="form1" method="post" action="<?= $PHP_SELF?>"> 
<table width="256" border="0" align="center" cellpadding="0" cellspacing="0" class="forumline"> 
<tr valign="baseline"> 
<td colspan="2" class="row1"> 
<?=$row['¿Quién ganará el torneo?']; ?> 
<br> 
</td> 
</tr> 
<tr> 
<td width="110"> 
<?=$row['Boca'];?> 
Boca</td> 
<td width="146"><input type="radio" name="voto" value="1"> 
</td> 
</tr> 
<tr> 
<td> 
<?=$row['River'];?>River
</td> 
<td><input type="radio" name="voto" value="2"></td> 
</tr> 
<tr> 
<td> 
<?=$row['Lanus'];?>Lanus
</td> 
<td><input type="radio" name="voto" value="3"></td> 
</tr> 
<tr align="center"> 
<td height="20" colspan="2"><input type="submit" class="post"name="Submit" value="Votar" onClick=window.open("resultados.php","","toolbar=0 ,location=0,directories=0,status=0,menubar=0,scrol lbars=0,resizable=0,width=320,height=200"); 
></td> 
</tr> 
</table> 
<p>&nbsp;</p></form> 
</body>
</html>
resultados.php
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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<html> 
<head> 
<title>Resultados de la encuesta</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<style type="text/css"> 
<!-- 
body { 
font-family: Verdana, Arial, Helvetica, sans-serif; 
font-size: 10px; 
background-color: #FFFFDD; 

td { 
font-family: Verdana, Arial, Helvetica, sans-serif; 
font-size: 10px; 

--> 
</style> 
</head> 
<body> 
<? 
$servidor 
"localhost"
$usuario "w1070536"
$password "kuzufiSO13"
$base_de_datos "w1070536_encuesta"
$conextar=mysql_connect ($servidor,$usuario,$password); 
mysql_select_db($base_de_datos); 
//$sqlupdate = "UPDATE encuestas SET valor$voto = valor$voto+1, total = total+1"; 
//mysql_query($sqlupdate,$conextar); 
$sql "SELECT * FROM encuestas ORDER BY idencuesta desc LIMIT 1"
$row mysql_fetch_array($sql); 
$res1round ($row['valor1']*100/$row['total'],2); 
$res2round ($row['valor2']*100/$row['total'],2); 
$res3round ($row['valor3']*100/$row['total'],2); 
?> 
<p>Resultados parciales de la encuesta</p> 
<?=$row['¿Quién ganará el torneo?']; ?><br> 
<br> 

<TABLE WIDTH="300" BORDER="1" ALIGN="center" BORDERCOLOR="#3097A3"> 
<TR> 
<TD WIDTH="100"><?=$row['Boca']; ?></TD> 
<TD WIDTH="*"><IMG SRC="barra.gif" WIDTH="15" HEIGHT="25" border="0"></TD> 
<TD ALIGN="center" WIDTH="70"><? echo $res1."%";?> </TD> 
</TR> 
<TR> 
<TD WIDTH="100" ><?=$row['River']; ?></TD> 
<TD WIDTH="*"><IMG SRC="barra.gif" WIDTH="15" HEIGHT="25" border="0"></TD> 
<TD ALIGN="center" WIDTH="70"><? echo $res2."%";?> </TD> 
</TR> 
<TR> 
<TD WIDTH="100"><?=$row['Lanus']; ?></TD> 
<TD WIDTH="*"><IMG HEIGHT="25" WIDTH="15" SRC="barra.gif"></TD> 
<TD ALIGN="center" WIDTH="70"><? echo $res3."%";?> </TD> 
</TR> 
</TABLE> 
<form name="form1" method="post" action=""> 
<div align="center"> 
<p> 
<input type="submit" name="Submit" value="Cerrar Ventana" onclick="window.close();"> 
</p> 
<p>&nbsp; </p> 
</div> 
</form> 
</body> 
</html> 
</body>
</html>
Si no te anda, deve ser la tabla.

Suerte
Salu2
__________________
Half Music - www.halfmusic.com