I'm trying to write a PHP script which allows to enter an username and a
password and to click two buttons.
If I start my PHP scripts 'mytest.php' I see the two input fields and the
two buttons. However if I enter something to the input fields and press a
button the echo commands show nothing.
======
PHP script 'mytest.php'
-----------------------
<?php
session_start();
if (!isset($_SESSION['auth_ok'])) {
$_SESSION['auth_ok'] = false;
}
echo "$user <br>";
echo "$pass <br>";
echo "$button1 <br>";
echo "$button2 <br>";
echo "$auth_ok <br>";
if (isset($button1)){
echo "Button 1 has been pressed<br>";
$auth_ok = true;
}
if (isset($button2)){
echo "Button 2 has been pressed<br>";
$auth_ok = true;
}
?>
<html>
<body>
<form name="loginform" method="post" action="mytest.php">
Username: <input type="text" name="user" size="30" maxlength="30"><br>
Passwort: <input type="password" name="pass" size="30"
maxlength="30"><br>
<input type="submit" name="button1" value="Button 1">
<input type="submit" name="button2" value="Button 2">
</form>
</body>
</html>
======
The PHP error logs shows the following errors:
[22-Apr-2005 19:02:17] PHP Notice: Undefined variable: user in
D:\WWW\php\mytest.php on line 8
[22-Apr-2005 19:02:17] PHP Notice: Undefined variable: pass in
D:\WWW\php\mytest.php on line 9
[22-Apr-2005 19:02:17] PHP Notice: Undefined variable: button1 in
D:\WWW\php\mytest.php on line 10
[22-Apr-2005 19:02:17] PHP Notice: Undefined variable: button2 in
D:\WWW\php\mytest.php on line 11
[22-Apr-2005 19:02:17] PHP Notice: Undefined variable: auth_ok in
D:\WWW\php\mytest.php on line 12
I'm very confused because my colleague told me that the same script on his
machine is running without any problems.
Has someone any idea what's wrong with my script or my server?
Stefan