You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "CSU Internet Inc." <cs...@yahoo.com> on 2002/09/15 03:41:14 UTC
[users@httpd] Apache 2.0.40 & PHP 4.3
I compiled PHP 4.3 with Apache 2.0.40 and it parses
PHP files OK.........the problem I'm having is that
it's not processing forms. Can someone tell me what's
wrong with this script?
<HTML>
<HEAD>
<TITLE>test</TITLE>
</HEAD>
<BODY>
<FORM action='test.php' method='post'>
Enter name: <input type='text' name='name'>
<input type='submit' value='Say hello'>
</FORM>
<? if (!$name) {
echo "Please enter name.";
}
else {
echo "Hello $name";
}
?>
</BODY></HTML>
I get the form but it doesn't print the name from the
input. It prints the "Please enter name."
though......any clues on this?
__________________________________________________
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Apache 2.0.40 & PHP 4.3
Posted by Robert Andersson <ro...@profundis.nu>.
Just a suggestion. Instead of $_POST and $_GET, use rather the $_REQUEST
array, as it combines both, and therefor are less dependent on the request
method.
Regards,
Robert Andersson
----- Original Message -----
From: "CSU Internet Inc." <cs...@yahoo.com>
To: <us...@httpd.apache.org>
Sent: Sunday, September 15, 2002 4:58 AM
Subject: RE: [users@httpd] Apache 2.0.40 & PHP 4.3
> Ahh.......didn't know that. I'll use the new standard
> instead of turning on globals. I guess I should also
> pick up the most recent PHP book too.
>
> Thnx for the info and the URL :o)
>
>
> --- MET <me...@uberstats.com> wrote:
> > Just guessing here, but if you weren't aware as of
> > PHP 4.2.0 global
> > variables have been turned off. Meaning that in
> > order to pick up
> > variables upon a form submission either POST or GET
> > you cannot just
> > write the name of the form field with $ in front of
> > it.
> >
> > So here are your options:
> >
> > 1. The easiest way, and less secure is this. Find
> > your php.ini file
> > and search for 'register_globals' and make it equal
> > to 'On' instead of
> > 'Off'. This is not suggested as it creates a pretty
> > big security hole.
> >
> > 2. The best way, but creates using old scripts
> > extremely annoying.
> > When grabbing the variable for printing on the form
> > submission page do
> > this.
> >
> >
> > <?php
> > if ( !isset($_POST['name']) )
> > {
> > print "Please enter name.";
> > }
> > else
> > {
> > print "Hello " . $_POST['name'];
> > }
> > ?>
> >
> > Notice the $_POST variable, its basically an array
> > holding each of the
> > variables that came across from the form post. You
> > can also replace
> > $_POST with $_GET depending on what type of form
> > submission you use.
> >
> > I would suggest reading this...
> > http://www.zend.com/zend/art/art-sweat4.php
> >
> >
> > ~ Matthew
> >
> >
> > -----Original Message-----
> > From: Lynne K. [mailto:lynzk@tht.net]
> > Sent: Saturday, September 14, 2002 10:03 PM
> > To: users@httpd.apache.org
> > Subject: Re: [users@httpd] Apache 2.0.40 & PHP 4.3
> >
> >
> > Hello,
> >
> > Try the following:
> >
> > <FORM action='test.php' method='post'>
> > Enter name: <input type='text' name='name'>
> > <input type='submit' value='Say hello'>
> > </FORM>
> >
> > <?php
> > if (!$name)
> > {
> > print "Please enter name.";
> > }
> > else
> > {
> > print "Hello ".$name;
> > }
> > ?>
> >
> > ----- Original Message -----
> > From: "CSU Internet Inc." <cs...@yahoo.com>
> > To: <us...@httpd.apache.org>
> > Sent: Saturday, September 14, 2002 9:41 PM
> > Subject: [users@httpd] Apache 2.0.40 & PHP 4.3
> >
> >
> > > I compiled PHP 4.3 with Apache 2.0.40 and it
> > parses
> > > PHP files OK.........the problem I'm having is
> > that
> > > it's not processing forms. Can someone tell me
> > what's
> > > wrong with this script?
> > >
> > > <HTML>
> > > <HEAD>
> > > <TITLE>test</TITLE>
> > > </HEAD>
> > >
> > > <BODY>
> > > <FORM action='test.php' method='post'>
> > > Enter name: <input type='text' name='name'>
> > > <input type='submit' value='Say hello'>
> > > </FORM>
> > >
> > > <? if (!$name) {
> > > echo "Please enter name.";
> > > }
> > > else {
> > > echo "Hello $name";
> > > }
> > > ?>
> > >
> > > </BODY></HTML>
> > >
> > > I get the form but it doesn't print the name from
> > the
> > > input. It prints the "Please enter name."
> > > though......any clues on this?
> > >
> > >
> > > __________________________________________________
> > > Do you Yahoo!?
> > > Yahoo! News - Today's headlines
> > > http://news.yahoo.com
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > The official User-To-User support forum of the
> > Apache HTTP Server
> > > Project. See
> > <URL:http://httpd.apache.org/userslist.html> for
> > more
> > > info. To unsubscribe, e-mail:
> > users-unsubscribe@httpd.apache.org
> > > " from the digest:
> > users-digest-unsubscribe@httpd.apache.org
> > > For additional commands, e-mail:
> > users-help@httpd.apache.org
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > The official User-To-User support forum of the
> > Apache HTTP Server
> > Project. See
> > <URL:http://httpd.apache.org/userslist.html> for
> > more info.
> > To unsubscribe, e-mail:
> > users-unsubscribe@httpd.apache.org
> > " from the digest:
> > users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail:
> > users-help@httpd.apache.org
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > The official User-To-User support forum of the
> > Apache HTTP Server Project.
> > See <URL:http://httpd.apache.org/userslist.html> for
> > more info.
> > To unsubscribe, e-mail:
> > users-unsubscribe@httpd.apache.org
> > " from the digest:
> > users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail:
> > users-help@httpd.apache.org
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes
> http://finance.yahoo.com
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: [users@httpd] Apache 2.0.40 & PHP 4.3
Posted by "CSU Internet Inc." <cs...@yahoo.com>.
Ahh.......didn't know that. I'll use the new standard
instead of turning on globals. I guess I should also
pick up the most recent PHP book too.
Thnx for the info and the URL :o)
--- MET <me...@uberstats.com> wrote:
> Just guessing here, but if you weren't aware as of
> PHP 4.2.0 global
> variables have been turned off. Meaning that in
> order to pick up
> variables upon a form submission either POST or GET
> you cannot just
> write the name of the form field with $ in front of
> it.
>
> So here are your options:
>
> 1. The easiest way, and less secure is this. Find
> your php.ini file
> and search for 'register_globals' and make it equal
> to 'On' instead of
> 'Off'. This is not suggested as it creates a pretty
> big security hole.
>
> 2. The best way, but creates using old scripts
> extremely annoying.
> When grabbing the variable for printing on the form
> submission page do
> this.
>
>
> <?php
> if ( !isset($_POST['name']) )
> {
> print "Please enter name.";
> }
> else
> {
> print "Hello " . $_POST['name'];
> }
> ?>
>
> Notice the $_POST variable, its basically an array
> holding each of the
> variables that came across from the form post. You
> can also replace
> $_POST with $_GET depending on what type of form
> submission you use.
>
> I would suggest reading this...
> http://www.zend.com/zend/art/art-sweat4.php
>
>
> ~ Matthew
>
>
> -----Original Message-----
> From: Lynne K. [mailto:lynzk@tht.net]
> Sent: Saturday, September 14, 2002 10:03 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Apache 2.0.40 & PHP 4.3
>
>
> Hello,
>
> Try the following:
>
> <FORM action='test.php' method='post'>
> Enter name: <input type='text' name='name'>
> <input type='submit' value='Say hello'>
> </FORM>
>
> <?php
> if (!$name)
> {
> print "Please enter name.";
> }
> else
> {
> print "Hello ".$name;
> }
> ?>
>
> ----- Original Message -----
> From: "CSU Internet Inc." <cs...@yahoo.com>
> To: <us...@httpd.apache.org>
> Sent: Saturday, September 14, 2002 9:41 PM
> Subject: [users@httpd] Apache 2.0.40 & PHP 4.3
>
>
> > I compiled PHP 4.3 with Apache 2.0.40 and it
> parses
> > PHP files OK.........the problem I'm having is
> that
> > it's not processing forms. Can someone tell me
> what's
> > wrong with this script?
> >
> > <HTML>
> > <HEAD>
> > <TITLE>test</TITLE>
> > </HEAD>
> >
> > <BODY>
> > <FORM action='test.php' method='post'>
> > Enter name: <input type='text' name='name'>
> > <input type='submit' value='Say hello'>
> > </FORM>
> >
> > <? if (!$name) {
> > echo "Please enter name.";
> > }
> > else {
> > echo "Hello $name";
> > }
> > ?>
> >
> > </BODY></HTML>
> >
> > I get the form but it doesn't print the name from
> the
> > input. It prints the "Please enter name."
> > though......any clues on this?
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! News - Today's headlines
> > http://news.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > The official User-To-User support forum of the
> Apache HTTP Server
> > Project. See
> <URL:http://httpd.apache.org/userslist.html> for
> more
> > info. To unsubscribe, e-mail:
> users-unsubscribe@httpd.apache.org
> > " from the digest:
> users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail:
> users-help@httpd.apache.org
>
>
>
>
---------------------------------------------------------------------
> The official User-To-User support forum of the
> Apache HTTP Server
> Project. See
> <URL:http://httpd.apache.org/userslist.html> for
> more info.
> To unsubscribe, e-mail:
> users-unsubscribe@httpd.apache.org
> " from the digest:
> users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail:
> users-help@httpd.apache.org
>
>
>
>
---------------------------------------------------------------------
> The official User-To-User support forum of the
> Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for
> more info.
> To unsubscribe, e-mail:
> users-unsubscribe@httpd.apache.org
> " from the digest:
> users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail:
> users-help@httpd.apache.org
>
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: [users@httpd] Apache 2.0.40 & PHP 4.3
Posted by MET <me...@uberstats.com>.
Just guessing here, but if you weren't aware as of PHP 4.2.0 global
variables have been turned off. Meaning that in order to pick up
variables upon a form submission either POST or GET you cannot just
write the name of the form field with $ in front of it.
So here are your options:
1. The easiest way, and less secure is this. Find your php.ini file
and search for 'register_globals' and make it equal to 'On' instead of
'Off'. This is not suggested as it creates a pretty big security hole.
2. The best way, but creates using old scripts extremely annoying.
When grabbing the variable for printing on the form submission page do
this.
<?php
if ( !isset($_POST['name']) )
{
print "Please enter name.";
}
else
{
print "Hello " . $_POST['name'];
}
?>
Notice the $_POST variable, its basically an array holding each of the
variables that came across from the form post. You can also replace
$_POST with $_GET depending on what type of form submission you use.
I would suggest reading this...
http://www.zend.com/zend/art/art-sweat4.php
~ Matthew
-----Original Message-----
From: Lynne K. [mailto:lynzk@tht.net]
Sent: Saturday, September 14, 2002 10:03 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Apache 2.0.40 & PHP 4.3
Hello,
Try the following:
<FORM action='test.php' method='post'>
Enter name: <input type='text' name='name'>
<input type='submit' value='Say hello'>
</FORM>
<?php
if (!$name)
{
print "Please enter name.";
}
else
{
print "Hello ".$name;
}
?>
----- Original Message -----
From: "CSU Internet Inc." <cs...@yahoo.com>
To: <us...@httpd.apache.org>
Sent: Saturday, September 14, 2002 9:41 PM
Subject: [users@httpd] Apache 2.0.40 & PHP 4.3
> I compiled PHP 4.3 with Apache 2.0.40 and it parses
> PHP files OK.........the problem I'm having is that
> it's not processing forms. Can someone tell me what's
> wrong with this script?
>
> <HTML>
> <HEAD>
> <TITLE>test</TITLE>
> </HEAD>
>
> <BODY>
> <FORM action='test.php' method='post'>
> Enter name: <input type='text' name='name'>
> <input type='submit' value='Say hello'>
> </FORM>
>
> <? if (!$name) {
> echo "Please enter name.";
> }
> else {
> echo "Hello $name";
> }
> ?>
>
> </BODY></HTML>
>
> I get the form but it doesn't print the name from the
> input. It prints the "Please enter name."
> though......any clues on this?
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! News - Today's headlines
> http://news.yahoo.com
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project. See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Apache 2.0.40 & PHP 4.3
Posted by "Lynne K." <ly...@tht.net>.
Hello,
Try the following:
<FORM action='test.php' method='post'>
Enter name: <input type='text' name='name'>
<input type='submit' value='Say hello'>
</FORM>
<?php
if (!$name)
{
print "Please enter name.";
}
else
{
print "Hello ".$name;
}
?>
----- Original Message -----
From: "CSU Internet Inc." <cs...@yahoo.com>
To: <us...@httpd.apache.org>
Sent: Saturday, September 14, 2002 9:41 PM
Subject: [users@httpd] Apache 2.0.40 & PHP 4.3
> I compiled PHP 4.3 with Apache 2.0.40 and it parses
> PHP files OK.........the problem I'm having is that
> it's not processing forms. Can someone tell me what's
> wrong with this script?
>
> <HTML>
> <HEAD>
> <TITLE>test</TITLE>
> </HEAD>
>
> <BODY>
> <FORM action='test.php' method='post'>
> Enter name: <input type='text' name='name'>
> <input type='submit' value='Say hello'>
> </FORM>
>
> <? if (!$name) {
> echo "Please enter name.";
> }
> else {
> echo "Hello $name";
> }
> ?>
>
> </BODY></HTML>
>
> I get the form but it doesn't print the name from the
> input. It prints the "Please enter name."
> though......any clues on this?
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! News - Today's headlines
> http://news.yahoo.com
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org