First time playing with PHP, Apache, and MySQL. I have a simple form error
and I don't know how to solve it. I was doing the Webmonkey PHP/MySQL
tutorial and when I started using forms with $PHP_SELF I started getting
errors with variables not defined.
PHP 4.2.3
MySQL 4.0 Windows 2000
Apache 1.3.27 (Since I was not able to get 2.0 working on Windows 2K Pro)
My code is:
//---------- START OF CODE --------------
<html><body><?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result)) {
do {
printf("
<a href=\"%s?id=%s\">%s %s</a><br>\n",
$PHP_SELF,
$myrow["id"],
$myrow["first"],
$myrow["last"]
);
} while ($myrow = mysql_fetch_array($result));
}
else {
echo "Sorry, no records were found!";
}
?>
</body></html>
//-------------------------------------------------
My ERROR is:
Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache
Group\Apache\htdocs\mysql2.php on line 11
Bob Smith
Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache
Group\Apache\htdocs\mysql2.php on line 11
John Roberts
Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache
Group\Apache\htdocs\mysql2.php on line 11
Brad Johnson
Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache
Group\Apache\htdocs\mysql2.php on line 11
Mar f
--------------- END OF ERROR ----------------------------
I am able to connect to the MySQL DB and retrieve info, but I don't get the
error. I changed the REGISTER_GLOBALS of the php.ini file to ON and I still
get the variables error. I also added $_POST as stated in another form
issue but it did not resolve my problem. It must be simple but I don't know
enough to identify the issue.
Thanks for any help or input.
Mario
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php