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

Posted by Jerry Stuckle on 11/28/05 23:03

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.


--
==================
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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация