Autor Zpráva
shArk
Profil
ako mám opraviť ak mi vypíše :
Notice: Undefined variable: send in c:\program files\easyphp\www\anketa.php on line 7


Notice: Undefined variable: one in c:\program files\easyphp\www\anketa.php on line 70

Notice: Undefined variable: two in c:\program files\easyphp\www\anketa.php on line 78

Notice: Undefined variable: three in c:\program files\easyphp\www\anketa.php on line 88

Notice: Undefined variable: four in c:\program files\easyphp\www\anketa.php on line 97

Notice: Undefined variable: five in c:\program files\easyphp\www\anketa.php on line 106

anketa je tu :
<?

if (File_Exists ("anketa/1.dat")):
$fp = FOpen("anketa.dat", "r");
$data_anketa = FRead ($fp, FileSize("anketa/1.dat"));
List($one,$two,$three,$four,$five) = Explode("#", $data_anketa);
endif;
if ($send=="ano" && ($anketa == "1" || $anketa == "2" || $anketa == "3" || $anketa == "4" || $anketa == "5")):
if (!File_Exists ("anketa/1.dat")):
$one = "0";
$two = "0";
$three = "0";
$four = "0";
$five = "0";
$fp = FOpen("anketa/1.dat", "w");
FWrite ($fp, $one ."#" . $two . "#" . $three . "#" . $four . "#" . $five );
FClose($fp);
endif;
if (File_Exists("anketa/ip.dat")):
$fp = FOpen("anketa/ip.dat", "r");
$data_ip = FRead ($fp, FileSize("anketa/ip.dat"));
$IP = Explode("#", $data_ip);
FClose ($fp);
endif;
for ($i=0;$i<Count($IP);$i++):
if ($REMOTE_ADDR == $IP[$i]):
$zapis = "nie";
endif;
endfor;
if ($zapis != "nie"):
if ($anketa == "ano"):
$one += 1;
$data_anketa = $one . "#" . $two . "#" . $three . "#" . $four . "#" . $five;
elseif ($anketa == "nie"):
$two += 1;
$data_anketa = $one . "#" . $two . "#" . $three . "#" . $four . "#" . $five;
else:
$three += 1;
$data_anketa = $one . "#" . $two . "#" . $three . "#" . $four . "#" . $five;
$four += 1;
$data_anketa = $one . "#" . $two . "#" . $three . "#" . $four . "#" . $five;
$five += 1;
$data_anketa = $one . "#" . $two . "#" . $three . "#" . $four . "#" . $five;
endif;
$fp = FOpen ("anketa/1.dat", "w");
FWrite ($fp, $data_anketa);
FClose ($fp);
$fp = FOpen("anketa/ip.dat", "a");
FWrite ($fp, "#" . $REMOTE_ADDR);
FClose ($fp);
endif;
endif;
?>


<TABLE bordercolor="red" border="1" height="300">
<TR>
<TD colspan='3' bgcolor='#cccccc'>
Páci sa Vám stránka ?
</TD>
</TR>

<form method="post">
<TR>
<TD>
1
</TD>


<TD><input type="radio" name="anketa" value="1"></TD>
<? echo "<TD align='right'>$one</TD>";?>
</TR>

<TR>
<TD>
2
</TD>
<TD><input type="radio" name="anketa" value="2"></TD>
<? echo "<TD align='right'>$two</TD>";?>

</TR>


<TR>
<TD>
3
</TD>
<TD><input type="radio" name="anketa" value="3"></TD>
<? echo "<TD align='right'>$three</TD>";?>

</TR>

<TR>
<TD>
4
</TD>
<TD><input type="radio" name="anketa" value="4"></TD>
<? echo "<TD align='right'>$four</TD>";?>

</TR>


<TR>
<TD>
5</TD>
<TD><input type="radio" name="anketa" value="5"></TD>
<? echo "<TD align='right'>$five</TD>";?>

</TR>

<?
if (File_Exists ("anketa/1.dat")):
$soucet = $one + $five + $three + $four + $five;
$width1 = 115/$soucet*$one;
$width2 = 115/$soucet*$two;
$width3 = 115/$soucet*$three;
$width4 = 115/$soucet*$four;
$width5 = 115/$soucet*$five;

echo "
<TR>
<TD colspan='3'>
<CENTER>hlasovalo už &nbsp;$soucet</CENTER>
</TD>
</TR>
";

?>
<?
endif;
if (File_Exists("anketa/ip.dat")):
$fp = FOpen("anketa/ip.dat", "r");
$data_ip = FRead ($fp, FileSize("anketa/ip.dat"));
$IP = Explode("#", $data_ip);
FClose ($fp);
for ($i=0;$i<Count($IP);$i++):
if ($REMOTE_ADDR == $IP[$i]):
$zapis = "nie";
endif;
endfor;
if ($zapis == "nie"):
echo " <TR><TD colspan='3' bgcolor='#cccccc'><CENTER>Už Ste hlasovali.</CENTER></TR></TD>";
else:
echo '<TR><TD colspan="3" bgcolor="#cccccc"><CENTER><input type="submit" value="Hlasovat"></CENTER></TD></TR>';
endif;
else:
echo '<CENTER><input type="submit" value="Hlasovat"></CENTER></TD></TR>';
endif;
?>
<input type="hidden" name="send" value="ano">
</form>
</TABLE>
koudi
Profil
buď používat podmínky IsSet, nebo nevypisovat notice hlášky (hledej zde ve fóru)
t.h.
Profil *
normalne naper pred ty radky kde ti to hazi upozorneni @
koudi
Profil
t.h.
to neni moc elegantní řešení
Anonymní
Profil *
mohol by to niekto opraviť? som trošku lamka v php:p
Toto téma je uzamčeno. Odpověď nelze zaslat.