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

Posted by Hilarion on 11/28/05 20:54

> <?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.

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


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

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