[ webjunior @ 21.04.2012. 14:36 ] @
logovanje.htm : Code: <!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=utf-8" /> <title>Sajt</title> <link href="logovanje.css" rel="stylesheet" type="text/css" /> </head> <body> <div align="center"> <div class="logovanje"> <form id="logovanje" name="logovanje" method="post" action="provera.php"> <label>Nadimak</label> <br /> <input name="nadimak" type="text" class="unos" id="nadimak" size="30" maxlength="30" /> <br /> <label>Lozinka</label> <br /> <input name="lozinka" type="password" class="unos" id="lozinka" size="30" maxlength="30" /> <br /> <input name="button" type="submit" class="dugme" id="button" value="Prijavi se" /> </form> <p><a href="registracija.htm">Registracija</a></p> </div> </div> </body> </html> provera.php : Code: <html> <head> <title>naslov</title> </head> <body> <?php $errors = 0; if (!trim($nadimak)) { echo "Nadimak je obavezan."; $errors++; } if (!trim($lozinka)) { echo "Lozinka je obavezna."; $errors++; } if ($errors == 0) echo "dobro je. "; if ($errors == 1) echo " jedna greska, "; if ($errors == 2) echo " dve greske, "; ?> </body> </html> Gde je ovde greska? Tj. bez obzira da li unosim nesto u polja kad kliknem dugme "Prijavi se" dobijam ovakav izlaz: Nadimak je obavezan.Lozinka je obavezna. dve greske, |