Ciao ragazzi ho un problema con un semplice form;
Ho creato una tabella in html di seguito posto il codice (form.html):
<html>
<head>
<title>Form username-password</title>
</head>
<body style="background-color:BLANCHEDALMOND;">
<form method=post action="esempio1.php">
</br>
<h2 align="center" style="font-family:verdana;color:FORESTGREEN; font-size:25px">Form per la gestione dei dati personali </h2>
</br>
<h3 align="center" style="font-face:verdana;color:FORESTGREEN; font-size:18px"> Per accedere inserire nome utente e password e cliccare sul tasto OK </h3>
</br>
<table width="300" height="150" border="0" align="center" bgcolor="GAINSBORO";>
<tr>
<th>User name <input type="text" name=“nome"> </th>
</tr>
<tr>
<th>Password <input type="password" name=“pwd"> </th>
</tr>
<tr>
<td > <center> <input type="submit" value="OK"> <input type="reset" value="Cancella"> </td></center>
</tr>
</table>
</form>
</body>
</html>
Poi ho creato il file esempio1.php che interagisce con l'html, posto il codice:
<html>
<body>
<?php
$usr = $_POST["nome"];
$pass = $_POST["pwd"];
if($pass == '123')
echo "ciao $usr Sei loggato!";
else
echo "mi dispiace $usr. La password è errata";
?>
</body>
</html>
In localhost di Apache faccio partire form.html, inserisco il nome utente e la password giusta ad esempio(123) ma mi vengono fuori 2 errori che sinceramente non saprei correggere..cioè non capisco proprio dove sia l'errore!!
Elenco gli errori:
Notice: Undefined index: nome in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\esempio1.php on line 6
Notice: Undefined index: pwd in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\esempio1.php on line 7
mi dispiace . La password è errata
Grazie a tutti siete mitici![]()
![]()
![]()