ho strutturato un sondaggio online con una serie di 11 form concatenate con redirect
di seguito il codice della form:
<form action="vai.php" method="post">
MIGLIOR BAND EMERGENTE DEL 2004
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TR><TD width="80%">Cose Perse</TD><TD width="20%"><input name="bandemergente" type="radio" value="CosePerse" checked></TD></TR>
<TR><TD width="80%">Me for Rent</TD><TD width="20%"><input name="bandemergente" type="radio" value="MeForRent"></TD></TR>
<TR><TD width="80%">Meanwhile</TD><TD width="20%"><input name="bandemergente" type="radio" value="Meanwhile"></TD></TR>
<TR><TD width="80%">Bredford</TD><TD width="20%"><input name="bandemergente" type="radio" value="Bredford"></TD></TR>
<TR><TD width="80%">Aim</TD><TD width="20%"><input name="bandemergente" type="radio" value="Aim"></TD></TR>
<TR><TD width="80%">X-State Ride</TD><TD width="20%"><input name="bandemergente" type="radio" value="XStateRide"></TD></TR>
<TR><TD width="80%">May I Refuse</TD><TD width="20%"><input name="bandemergente" type="radio" value="MayIRefuse"></TD></TR>
<TR><TD width="80%">Settlefish</TD><TD width="20%"><input name="bandemergente" type="radio" value="Settlefish"></TD></TR>
<TR><TD width="80%">Pomata</TD><TD width="20%"><input name="bandemergente" type="radio" value="Pomata"></TD></TR>
<TR><TD width="80%">Ragasirifa</TD><TD width="20%"> <input name="bandemergente" type="radio" value="Ragasirifa"></TD></TR>
</TABLE>
<input type="submit" value="PROSEGUI VOTAZIONE">
</form>
questo il codice del file php che interagisce col database mysql:
<?php
include("db_connect.php");
if (!isset($HTTP_COOKIE_VARS[bluearrowcookie1]))
{
$risultati_mysql=mysql_query("SELECT * FROM emergente ");
while ($riga1=mysql_fetch_array($risultati_mysql))
{
$id=$riga1["$bandemergente"];
$idnuovo=($id + 1);
}
$sql="UPDATE emergente SET $bandemergente='$idnuovo' ";
setcookie ("bluearrowcookie1", "thebluearrow1");
if(!mysql_query($sql))
{
echo "Errore impossibile votare";
echo "<script>
function redirect(){
window.location.replace(\"sonda.htm\");}
setTimeout(\"redirect()\", 2000);
</script>";
exit();
}
else
{
echo "Voto valido";
echo "<script>
function redirect(){
window.location.replace(\"sonda2.htm\");}
setTimeout(\"redirect()\", 2000);
</script>";
}
mysql_close();
}
else
{
echo "Hai gia' votato!";
}
?>
il problema e' che non vorrei far vvotare piu' volte gli utenti per cui avevo pensato ai cookie...ma non funzionano...come mai?
qualcuno sa darmi una mano...anche magari con le sessioni??