Form variable to PHP script problems
| From: | Renato B. Miranda | Date: | Sun, 04 Aug 2002 23:29:39 +0000 |
| Subject: | Form variable to PHP script problems | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-111137@lists.php.net to get a copy of this message | ||
Hello !
I´m developing a dinamic site and I started to use PHP, MySQL and
Apache.
The things are going well, I´m already using database, inserting,
everything ....
But when I try to pass some variables from a Form to a PHP isn´t working
!
Somebody could help me ?
Here is my code .....
HTML
<html>
<p align="center"><font face="Arial Black" size="5">Banco
de Dados
Cesop</font></p>
<p align="center"> </p>
<form action="validaUsuario.php" method="post" >
<p align="center">Usuário: <input type="text"
NAME="nome"
size="20"></p>
<p align="center">Senha: <input
type="password" NAME="senha" size="20"></p>
<p align="center"><input type="submit" value="Submeter"
name="B1"></p>
</form>
</body>
</html>
PHP
<?
$connection = mysql_connect("localhost", "renato", "ren9ato8")
or die ("Unable to connect to server.");
$db = mysql_select_db("cesop", $connection)
or die ("Unable to select database.");
echo $senha;
$sql = "SELECT nome
FROM users
WHERE nome='$nome' and password='$senha'";
$result = mysql_query($sql, $connection)
or die ("Unable to get results.");
$num = mysql_numrows($result)
or die ("You're not authorized to be here. If you feel you have
recieved this
message in error, please contact the <a
href=\"mailto:tyler.longren@midiowa.net\">webmaster</a>");
if ($num == 1) {
echo "<p>You can be here<br>";
echo "Your username is $nome</p>";
}
?>
Thanks !