Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/05/2012, 12:19
Avatar de enlinea777
enlinea777
 
Fecha de Ingreso: mayo-2008
Ubicación: frente al pc
Mensajes: 1.830
Antigüedad: 16 años
Puntos: 127
Respuesta: Vote on click

humm.. al parecer no comprendes mucho las funciones de un form, el desarrollo web,y el desarrollo de aplicaciones cliente servidor.

pequeña clase para primerizos.

1 un form es para enviar firmularios osea datos.(hay que colocar el id de la foto en un input escondido para enviar el id de la foto al pinchar sobre ella)
2 el submint es automatico cuando haces y input type=image .
3 php se ejecuta en el servidor, devolviendo codigo html al navegador para interpretarlo.
osea se puede evaluar el id dela foto cada ves que entre, y si hay id sumar el voto
4 por ultimo si usas dreamweaver (sino porfavor usalo) escapa todo el HTML que puedas del codigo php.
EJEMPLO:
Código PHP:
// En lugar de hacer
echo='<input name="id" value="'.$foto1[id].'" type="text">';

//Es mejor
?><input name="id" value="1<?=$foto1[id]?>" type="text"><?
//si haces esto el DW mostrara el input en la pestaña diseño y no te pierdes tanto, ademas de que el procesoen el servidor gana y nos cuantos nanosegundos

fuentes:
http://webdesign.about.com/od/htmlta...-image-tag.htm
http://soporte.miarroba.es/17452/281...-de-una-celda/

TU SOLUCION:

Código PHP:
<?php
$id
=trim($_POST[id]);
if(
$id!=""){
mysql_query("update fotos set votos=votos+1 where id='$id'");
}
?>
<center>
<p><strong>Are looks supposed to matter?No. Will we be judged by them? Yes.</strong>
<p><strong>Who's hotter? Click to choose</strong></p>
<table align="center" width="410" border="0" height="250" cellspacing="0" cellpadding="0">
<tr><td width="200">
<?php
$datos
=mysql_query("select * from fotos where id='$id1'");
if(
$foto1=mysql_fetch_array($datos)){
?>
<form method='post' action='' name='form1'>
<input name="id" value="1<?=$foto1[id]?>" type="hidden">
<input type='image' src='fotos/<?=$foto1[nombre].".".$foto1[formato]?>' width='200' height='250'>
</form>
<?php
}
?>
</td>
<td width="10">Or</td>
<td width="200">
<?php
$datos2
=mysql_query("select * from fotos where id='$id2'");
if(
$foto2=mysql_fetch_array($datos2)){
?>
<form method='post'  action='' name='form2'>
<input name="id" value="2<?=$foto2[id]?>" type="hidden">
<input  type='image' src='fotos/<?=$foto2[nombre].".".$foto2[formato]?>' width='200' height='250'></form>
<?php
}
?>
</td></tr></table>

</center>
<hr id="menu_bottom">
<table align="center" border="0" width="100%">

<tr><td align="right" width="50%"><a style="margin:50px;" href=top10.php>Top 10 </a></td><td align="left"><a style="margin:50px;" href="submit.php"> Submit Video </a></td></tr></table>

revisalo y analizalo