You are here: Re: problems with POST « PHP Language « IT news, forums, messages
Re: problems with POST

Posted by Marty Meyers on 12/28/05 19:26

Hi all,
I have followed this thread with interest as I have almost the exact same
problem. ( I am new to PHP and have inherited a project with 100's of files
like this which I am moving to a new server). I also posted a similar
question which Irwin Moller answered and gave me some good tips to work
with. I have two differences from moriman's problem:
1) I don't see ANY entries when I dump the environment variables.
2) If I leave the form Method="POST", but return the variables I want as
"GET" args after the "?" then $_GET('name') works.

BTW-Moriman, Would you please post the specific's of the setting you found
in the Xtami server? I'm on Apache but there might be something similar
that I haven't found yet.

What I really don't understand is why GET will work but POST doesn't.
TIA for any suggestions on what to look for.
Marty


"moriman" <moriman@btinternet.com> wrote in message
news:dmftoe$n0m$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
>
> "moriman" <moriman@btinternet.com> wrote in message
> news:dmfsde$3hm$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
> >
> > "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
> > news:f-GdndK1_oNx7BbenZ2dnUVZ_vudnZ2d@comcast.com...
> > > moriman wrote:
> > > > "Hilarion" <hilarion@SPAM.op.SMIECI.pl> wrote in message
> > > > news:dmfjob$v07$1@news.onet.pl...
> > > >
> > > >>><?php
> > > >>>echo "<html><body>";
> > > >>>echo "\$p = $p<br><br>"; //###
> > > >>
> > > >>Use $_POST or $HTTP_POST_VARS as others have suggested ($_POST
> > > >>is preferred, $HTTP_POST_VARS only if $_POST does not work, which
> > > >>means that you have OLD version of PHP).
> > > >>
> > > >>
> > > >>>$str = <<<HTM
> > > >>><head>
> > > >>></head>
> > > >>><body>
> > > >>><form action="" method="post">
> > > >>
> > > >>Give some value to the "action" attribute. Using empty "action"
> > > >>works differently in different browser. Your browser probably
> > > >>does not send the data in this case.
> > > >>
> > > >
> > > >
> > > > action="" posts the data to the file\page that is loaded.
> > > > As you will also see from the OP, the data *is* being sent
> > > >
> > > >
> > > >>>on printing the $_ENV variables along with the the above script I
> find
> > > >
> > > > the
> > > >
> > > >>>following :
> > > >>>
> > > >>>QUERY_METHOD POST
> > > >>>REQUEST_METHOD POST
> > > >>>FORM_P f
> > > >>>FORM_R w
> > > >
> > > >
> > > > the FORM_P f and FORM_R w are the data that have been received. Only
I
> > can't
> > > > seem to 'get hold' of them.
> > > >
> > > >
> > > >>> <input type="hidden" name="r" value="w">
> > > >>> <input type="hidden" name="p" value="f">
> > > >>> <input type="image" src="http://home/images/faq-up.gif" border="0"
> > > >>>height="22" width="77">
> > > >>></form>
> > > >>></body>
> > > >>></html>
> > > >>>HTM;
> > > >>>echo $str;
> > > >>
> > > >>Why are you building HTML this way just to echo it?
> > > >>
> > > >>
> > > >>>?>
> > > >>>
> > > >>>
> > > >>>on printing the $_ENV variables along with the the above script I
> find
> > > >
> > > > the
> > > >
> > > >>>following :
> > > >>>
> > > >>>QUERY_METHOD POST
> > > >>>REQUEST_METHOD POST
> > > >>>FORM_P f
> > > >>>FORM_R w
> > > >>>
> > > >>>Is there something I haven't enabled in my
> > > >>>setup of PHP that is stopping this from working now?
> > > >>>
> > > >>>Or has something changed with PHP, so that I have to do this
another
> > > >
> > > > way?
> > > >
> > > >>Try this:
> > > >>
> > > >><html>
> > > >><head>
> > > >></head>
> > > >><body>
> > > >><pre>
> > > >>$_POST <?php print_r( $_POST ); ?>
> > > >>$HTTP_POST_VARS <?php print_r( $HTTP_POST_VARS ); ?>
> > > >></pre>
> > > >><form action="<?php echo htmlspecialchars( $_SERVER['PHP_SELF'] );
?>"
> > > >
> > > > method="post">
> > > >
> > > >> <input type="hidden" name="r" value="w" />
> > > >> <input type="hidden" name="p" value="f" />
> > > >> <input type="image" src="http://home/images/faq-up.gif" border="0"
> > > >> height="22" width="77" />
> > > >></form>
> > > >></body>
> > > >></html>
> > > >>
> > > >>
> > > >>And check HTML source which gets generated before and after
submiting
> > > >>the form. If it still does not work (does not output the posted
> values),
> > > >>then send what you got to this thread.
> > > >>
> > > >>
> > > >
> > > > There is some problem with your above action as it sends the post to
> > > >
> > > > http://home/public_html/test.php
> > > > not
> > > > http://home/test.php
> > > >
> > > > the absolute path to the script is
> C:/XITAMI-25/APP/public_html/test.php
> > > > where C:/XITAMI-25/APP/public_html/ is analogous to my server's
> > http://home
> > > >
> > > > I have also added the following to my script
> > > >
> > > > foreach ($_POST as $key => $value) {echo "{$key}={$value}<br>";}
> > > >
> > > > and this doesn't print anything. Very strange. How can I get
> > > >
> > > > FORM_P f
> > > > FORM_R w
> > > >
> > > > yet $_POST appears to be emptyΏ
> > > >
> > > > The further I go, the less I know
> > > >
> > > >
> > > >
> > > >>Hilarion
> > > >
> > > >
> > > >
> > > >
> > >
> > > What happens if your
> > >
> > > print_r($_POST);
> > >
> > > Also try it with $_GET and $_REQUEST.
> > >
> >
> > all 3 arrays are empty
> >
> > post <?php print_r($_POST); ?><br>
> > get <?php print_r($_GET); ?><br>
> > request <?php print_r($_REQUEST); ?><br>
> >
> > gives
> >
> > post Array ( )
> > get Array ( )
> > request Array ( )
> >
> >
>
> Ah!, finally found the prob, duh!
> My Xitami server has an option to pass form fields with a prefix. The
prefix
> was set to 'FORM_'.
> Removing this prefix allows my scripts to work again, phew!
>
> Thanks for your input ;-)
>
>
> > >
> > > --
> > > ==================
> > > Remove the "x" from my email address
> > > Jerry Stuckle
> > > JDS Computer Training Corp.
> > > jstucklex@attglobal.net
> > > ==================
> >
> >
> >
> >
> >
>
>

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация