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

Posted by moriman on 11/28/05 22:42

"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

 

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

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