php-windows Digest 20 Feb 2002 11:49:35 -0000 Issue 1009
Topics (messages 12153 through 12158):
WinXP Error Passing Variables (and creating)
12153 by: Chris
12154 by: Devon Knowles
12155 by: Chris
12156 by: Ross Fleming
12157 by: David Redmond
updating db
12158 by: Sandeep Murphy
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
I currently have been trying to learn PHP (as Apache module) and it doesn't
work. Through Apache I get this error:
"[Tue Feb 19 18:41:11 2002] [error] PHP Warning: Undefined variable:
username in ...filepath...\apache group\apache\htdocs\second.php on line 13"
The book I'm using to program with PHP says that by creating a NAME value
for a FORM gives me a variable with that name (and '$' included infront of
it). However, it doesn't seem to work that way:
Apache version: 1.3.23
PHP version: 4.1.1
OS: Windows XP
I think Windows XP and Apache are the problem because on their site they
have listed this warning for XP:
"If you will install Apache on Windows XP, be warned. There is a known bug
our users have identified; you may or may not encounter it yourself. It will
be fixed in the forthcoming Apache 1.3.24 release. The effects of this bug
within Apache 2.0 Beta are not yet determined.
It appears the combination of duplicating file handles between and parent
and child process, in conjunction with blocking sends to the http client,
may result in corrupted output. You may not see this in MSIE, which tends to
throw any error in the 'Cannot find server or DNS Error' category.
If you receive such errors on Windows XP using SSI scripting or PHP scripts,
but not static pages, you are probably a victim of this bug. It has been
reported to Microsoft, we have no further details at this time."
The thing is though, the bug is kind of a strange one... not creating the
variable. Is that the result of Apache and XP or am I doing something
completely wrong (in the following code I also tried the echo function):
--------------------------------------------CODE----------------------------
---------------------------
<HTML>
<BODY>
<FORM>
Please type your name here:<BR>
<INPUT TYPE="text" NAME=username><BR><BR>
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
<BR><BR>
You typed:
<?php
print($username);
?>
</BODY>
</HTML>
--- End Message ---
--- Begin Message ---
No offense, but you are doing something completely wrong. For starters,
your <form> has neither a method nor an action. Try this code, if you have
Apache and PHP installed correctly, it will work. Even on XP.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test Form</title>
</head>
<body>
<form action="<?= $PHP_SELF ?>" method="post">
<input type="text" name="username"><br>
<input type="submit" value="Post Data">
</form>
<?
if ($username)
{
echo "<b>Username:</b> " . $username;
} else
{
echo "<i>No data yet, or \$username is empty.</i>";
}
?>
</body>
</html>
"Chris" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I currently have been trying to learn PHP (as Apache module) and it
doesn't
> work. Through Apache I get this error:
> "[Tue Feb 19 18:41:11 2002] [error] PHP Warning: Undefined variable:
> username in ...filepath...\apache group\apache\htdocs\second.php on line
13"
>
> The book I'm using to program with PHP says that by creating a NAME value
> for a FORM gives me a variable with that name (and '$' included infront of
> it). However, it doesn't seem to work that way:
>
> Apache version: 1.3.23
> PHP version: 4.1.1
> OS: Windows XP
>
> I think Windows XP and Apache are the problem because on their site they
> have listed this warning for XP:
>
> "If you will install Apache on Windows XP, be warned. There is a known bug
> our users have identified; you may or may not encounter it yourself. It
will
> be fixed in the forthcoming Apache 1.3.24 release. The effects of this bug
> within Apache 2.0 Beta are not yet determined.
> It appears the combination of duplicating file handles between and parent
> and child process, in conjunction with blocking sends to the http client,
> may result in corrupted output. You may not see this in MSIE, which tends
to
> throw any error in the 'Cannot find server or DNS Error' category.
>
> If you receive such errors on Windows XP using SSI scripting or PHP
scripts,
> but not static pages, you are probably a victim of this bug. It has been
> reported to Microsoft, we have no further details at this time."
>
> The thing is though, the bug is kind of a strange one... not creating the
> variable. Is that the result of Apache and XP or am I doing something
> completely wrong (in the following code I also tried the echo function):
>
> --------------------------------------------CODE--------------------------
--
> ---------------------------
>
>
> <HTML>
> <BODY>
> <FORM>
> Please type your name here:<BR>
> <INPUT TYPE="text" NAME=username><BR><BR>
> <INPUT TYPE="submit" VALUE="Submit">
> </FORM>
> <BR><BR>
> You typed:
> <?php
> print($username);
> ?>
> </BODY>
> </HTML>
>
>
--- End Message ---
--- Begin Message ---
No offense taken, but I have never done this before so I don't really know
what I'm doing with the variable passing and stuff (aside from C++ and VB
knowledge). I copied that from the book exactly and it did not work.
Your form does not work either, it simply gives me the else statement's
actions ("No data yet, or $username is empty."). I do believe I hit the bug
they were talking about and am now thinking of getting Linux from my boss
too install and run for PHP. Thanks for the help.
"Devon Knowles" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> No offense, but you are doing something completely wrong. For starters,
> your <form> has neither a method nor an action. Try this code, if you have
> Apache and PHP installed correctly, it will work. Even on XP.
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <html>
> <head>
> <title>Test Form</title>
> </head>
> <body>
> <form action="<?= $PHP_SELF ?>" method="post">
> <input type="text" name="username"><br>
> <input type="submit" value="Post Data">
> </form>
> <?
> if ($username)
> {
> echo "<b>Username:</b> " . $username;
> } else
> {
> echo "<i>No data yet, or \$username is empty.</i>";
> }
> ?>
> </body>
> </html>
--- End Message ---
--- Begin Message ---
Try this instead. I couldn't get Devon's to work on my system either, but
this one does. Note the use of the empty() function which tests a string
for emptiness.
Let me know if it works?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test Form</title>
</head>
<body>
<?
if (empty($username))
{
echo "
<form method=post action=".$PHP_SELF.">
<input type=\"text\" name=\"username\"><br>
<input type=\"submit\" value=\"Post Data\">
</form><i>No data yet, or username is empty.</i>";
}
else
{
echo "<b>Username:</b> " . $username;
}
?>
</body>
</html>
-----Original Message-----
From: Chris Earle [mailto:[EMAIL PROTECTED]]
Sent: 20 February 2002 02:09
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Re: WinXP Error Passing Variables (and creating)
No offense taken, but I have never done this before so I don't really know
what I'm doing with the variable passing and stuff (aside from C++ and VB
knowledge). I copied that from the book exactly and it did not work.
Your form does not work either, it simply gives me the else statement's
actions ("No data yet, or $username is empty."). I do believe I hit the bug
they were talking about and am now thinking of getting Linux from my boss
too install and run for PHP. Thanks for the help.
"Devon Knowles" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> No offense, but you are doing something completely wrong. For starters,
> your <form> has neither a method nor an action. Try this code, if you have
> Apache and PHP installed correctly, it will work. Even on XP.
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <html>
> <head>
> <title>Test Form</title>
> </head>
> <body>
> <form action="<?= $PHP_SELF ?>" method="post">
> <input type="text" name="username"><br>
> <input type="submit" value="Post Data">
> </form>
> <?
> if ($username)
> {
> echo "<b>Username:</b> " . $username;
> } else
> {
> echo "<i>No data yet, or \$username is empty.</i>";
> }
> ?>
> </body>
> </html>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
This should also work;
-- snip --
<form action="<? echo $PHP_SELF; ?>" method="post">
Username: <input type="text" name="username"><br>
<input type="submit" value="Post Data">
</form>
<?
if ($username) {
echo "Username: ". $username ."<br>\n";
}
?>
-- snip --
-----Original Message-----
From: Ross Fleming [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 20 February 2002 1:06 PM
To: Chris Earle; [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] Re: WinXP Error Passing Variables (and creating)
Try this instead. I couldn't get Devon's to work on my system either, but
this one does. Note the use of the empty() function which tests a string
for emptiness.
Let me know if it works?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test Form</title>
</head>
<body>
<?
if (empty($username))
{
echo "
<form method=post action=".$PHP_SELF.">
<input type=\"text\" name=\"username\"><br>
<input type=\"submit\" value=\"Post Data\">
</form><i>No data yet, or username is empty.</i>";
}
else
{
echo "<b>Username:</b> " . $username;
}
?>
</body>
</html>
-----Original Message-----
From: Chris Earle [mailto:[EMAIL PROTECTED]]
Sent: 20 February 2002 02:09
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Re: WinXP Error Passing Variables (and creating)
No offense taken, but I have never done this before so I don't really know
what I'm doing with the variable passing and stuff (aside from C++ and VB
knowledge). I copied that from the book exactly and it did not work.
Your form does not work either, it simply gives me the else statement's
actions ("No data yet, or $username is empty."). I do believe I hit the bug
they were talking about and am now thinking of getting Linux from my boss
too install and run for PHP. Thanks for the help.
"Devon Knowles" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> No offense, but you are doing something completely wrong. For starters,
> your <form> has neither a method nor an action. Try this code, if you have
> Apache and PHP installed correctly, it will work. Even on XP.
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <html>
> <head>
> <title>Test Form</title>
> </head>
> <body>
> <form action="<?= $PHP_SELF ?>" method="post">
> <input type="text" name="username"><br>
> <input type="submit" value="Post Data">
> </form>
> <?
> if ($username)
> {
> echo "<b>Username:</b> " . $username;
> } else
> {
> echo "<i>No data yet, or \$username is empty.</i>";
> }
> ?>
> </body>
> </html>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,
Can anyone tell me how I can update a column in MySQL based on form
input????
TIA,
sands
--- End Message ---