472,133 Members | 1,168 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

problems with POST

Hi,

The script below *used* to work. I have only just set up a
server, PHP etc again on my Win98 system and now it doesn't?

On first loading this page, you would have

$p =

and the button image below it.
On clicking the button the same page would reload but pass the hidden values
(r=w & p=f)
so that the first line of the page would then have

$p = f

This no longer works???

<?php
echo "<html><body>";
echo "\$p = $p<br><br>"; //###
$str = <<<HTM
<head>
</head>
<body>
<form action="" 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>
HTM;
echo $str;
?>
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?

many thanks

mori

Nov 27 '05 #1
24 2745
>The script below *used* to work. I have only just set up a
server, PHP etc again on my Win98 system and now it doesn't?
A variable passed from HTML by the POST method is $_POST['r'] or
$_POST['p'], *not* $r or $p. (Also see $_GET for variables
passed by the GET method). Fix your script. Do not turn
on "register_globals".

Gordon L. Burditt


On first loading this page, you would have

$p =

and the button image below it.
On clicking the button the same page would reload but pass the hidden values
(r=w & p=f)
so that the first line of the page would then have

$p = f

This no longer works???

<?php
echo "<html><body>";
echo "\$p = $p<br><br>"; //###
$str = <<<HTM
<head>
</head>
<body>
<form action="" 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>
HTM;
echo $str;
?>
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?

many thanks

mori

Nov 27 '05 #2
wow, thx for the *very* quick reply ;-)

tried changing the
echo "\$p = $p<br><br>";

to

echo "\$p = " . $_POST['p'] . "<br><br>";

but still not working :(

mori

"Gordon Burditt" <go***********@burditt.org> wrote in message
news:11*************@corp.supernews.com...
The script below *used* to work. I have only just set up a
server, PHP etc again on my Win98 system and now it doesn't?


A variable passed from HTML by the POST method is $_POST['r'] or
$_POST['p'], *not* $r or $p. (Also see $_GET for variables
passed by the GET method). Fix your script. Do not turn
on "register_globals".

Gordon L. Burditt


On first loading this page, you would have

$p =

and the button image below it.
On clicking the button the same page would reload but pass the hidden values(r=w & p=f)
so that the first line of the page would then have

$p = f

This no longer works???

<?php
echo "<html><body>";
echo "\$p = $p<br><br>"; //###
$str = <<<HTM
<head>
</head>
<body>
<form action="" 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>
HTM;
echo $str;
?>
on printing the $_ENV variables along with the the above script I find thefollowing :

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?

many thanks

mori


Nov 27 '05 #3
Don't know much about PHP, but it does appear you are sending "<body>"
twice, once in line 2 and once in line 7. The one in line 2 should be
deleted so the "<head>" section of the page comes first. Or you need to
rearrange the order of your statements.

Nov 27 '05 #4

"PeteY48" <pe********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Don't know much about PHP, but it does appear you are sending "<body>"
twice, once in line 2 and once in line 7. The one in line 2 should be
deleted so the "<head>" section of the page comes first. Or you need to
rearrange the order of your statements.


Yes, you are right about the double <head>, this was due to shortening the
script and missing this repeat.
However, this makes absolutely no difference to the operation of the script.
Nov 28 '05 #5
moriman wrote:
wow, thx for the *very* quick reply ;-)

tried changing the
echo "\$p = $p<br><br>";

to

echo "\$p = " . $_POST['p'] . "<br><br>";

but still not working :(

mori

"Gordon Burditt" <go***********@burditt.org> wrote in message
news:11*************@corp.supernews.com...
The script below *used* to work. I have only just set up a
server, PHP etc again on my Win98 system and now it doesn't?


A variable passed from HTML by the POST method is $_POST['r'] or
$_POST['p'], *not* $r or $p. (Also see $_GET for variables
passed by the GET method). Fix your script. Do not turn
on "register_globals".

Gordon L. Burditt
On first loading this page, you would have

$p =

and the button image below it.
On clicking the button the same page would reload but pass the hidden
values
(r=w & p=f)
so that the first line of the page would then have

$p = f

This no longer works???

<?php
echo "<html><body>";
echo "\$p = $p<br><br>"; //###
$str = <<<HTM
<head>
</head>
<body>
<form action="" 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>
HTM;
echo $str;
?>
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?

many thanks

mori




Try:

echo "\$p = " . $HTTP_POST_VARS['p'] . "<br><br>";
Nov 28 '05 #6

"Juliette" <jr*********@jokeaday.net> wrote in message
news:43***********************@news.wanadoo.nl...
moriman wrote:
wow, thx for the *very* quick reply ;-)

tried changing the
echo "\$p = $p<br><br>";

to

echo "\$p = " . $_POST['p'] . "<br><br>";

but still not working :(

mori

"Gordon Burditt" <go***********@burditt.org> wrote in message
news:11*************@corp.supernews.com...
The script below *used* to work. I have only just set up a
server, PHP etc again on my Win98 system and now it doesn't?

A variable passed from HTML by the POST method is $_POST['r'] or
$_POST['p'], *not* $r or $p. (Also see $_GET for variables
passed by the GET method). Fix your script. Do not turn
on "register_globals".

Gordon L. Burditt

On first loading this page, you would have

$p =

and the button image below it.
On clicking the button the same page would reload but pass the hidden


values
(r=w & p=f)
so that the first line of the page would then have

$p = f

This no longer works???

<?php
echo "<html><body>";
echo "\$p = $p<br><br>"; //###
$str = <<<HTM
<head>
</head>
<body>
<form action="" 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>
HTM;
echo $str;
?>
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?
many thanks

mori




Try:

echo "\$p = " . $HTTP_POST_VARS['p'] . "<br><br>";


nope, doesn't work either :(
Nov 28 '05 #7


moriman wrote:
"Juliette" <jr*********@jokeaday.net> wrote in message
news:43***********************@news.wanadoo.nl...
moriman wrote:
wow, thx for the *very* quick reply ;-)

tried changing the
echo "\$p = $p<br><br>";

to

echo "\$p = " . $_POST['p'] . "<br><br>";

but still not working :(

mori

"Gordon Burditt" <go***********@burditt.org> wrote in message
news:11*************@corp.supernews.com...

> The script below *used* to work. I have only just set up a
> server, PHP etc again on my Win98 system and now it doesn't?
A variable passed from HTML by the POST method is $_POST['r'] or
$_POST['p'], *not* $r or $p. (Also see $_GET for variables
passed by the GET method). Fix your script. Do not turn
on "register_globals".

Gordon L. Burditt

> On first loading this page, you would have
>
> $p =
>
> and the button image below it.
> On clicking the button the same page would reload but pass the hidden
values

> (r=w & p=f)
> so that the first line of the page would then have
>
> $p = f
>
> This no longer works???
>
> <?php
> echo "<html><body>";
> echo "\$p = $p<br><br>"; //###
> $str = <<<HTM
> <head>
> </head>
> <body>
> <form action="" 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>
> HTM;
> echo $str;
> ?>
>
>
> 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?> many thanks
>
> mori
>
>
>

Try:

echo "\$p = " . $HTTP_POST_VARS['p'] . "<br><br>";


nope, doesn't work either :(


This will work, you have to set up an submit button
(javascript or nativ html to send your form data)

If you would like to have an image you should prefer JavaScript.
If a simple HTML - Button is enougth try the simple Submit Button like
in my example.
Have Fun...

<?php
echo "<html>";
echo "\$p = ".$_POST['p']."<br><br>"; //###
$str = <<<HTM
<head>
</head>
<body>
<form action="" method="post">
<input type="hidden" name="r" value="w">
<input type="hidden" name="p" value="f">
<input type="submit">
</form>
</body>
</html>
HTM;
echo $str;
?>
Nov 28 '05 #8
moriman wrote:
Hi,

The script below *used* to work. I have only just set up a
server, PHP etc again on my Win98 system and now it doesn't?

On first loading this page, you would have

$p =

and the button image below it.
On clicking the button the same page would reload but pass the hidden values
(r=w & p=f)
so that the first line of the page would then have

$p = f

This no longer works???

<?php
echo "<html><body>";
echo "\$p = $p<br><br>"; //###
$str = <<<HTM
<head>
</head>
<body>
<form action="" 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>
HTM;
echo $str;
?>
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?

many thanks

mori

How are you submitting your form? I don't see a submit button, for
instance.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 28 '05 #9
vdP
Jerry Stuckle wrote:
moriman wrote:
<form action="" 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>

How are you submitting your form? I don't see a submit button, for
instance.

I thought the same till I looked up the HTML-specification at
http://www.w3.org/TR/REC-html40/inte...ms.html#h-17.4
Apparently the input of image type serves as a submit button.

vdP
Nov 28 '05 #10
> <?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
Nov 28 '05 #11
"Wolfgang Forstmeier" <wo*****************@gmx.de> wrote in message
news:dm**********@news.mch.sbs.de...


moriman wrote:
"Juliette" <jr*********@jokeaday.net> wrote in message
news:43***********************@news.wanadoo.nl...
moriman wrote:
wow, thx for the *very* quick reply ;-)

tried changing the
echo "\$p = $p<br><br>";

to

echo "\$p = " . $_POST['p'] . "<br><br>";

but still not working :(

mori

"Gordon Burditt" <go***********@burditt.org> wrote in message
news:11*************@corp.supernews.com...

>> The script below *used* to work. I have only just set up a
>> server, PHP etc again on my Win98 system and now it doesn't?
> A variable passed from HTML by the POST method is $_POST['r'] or
> $_POST['p'], *not* $r or $p. (Also see $_GET for variables
> passed by the GET method). Fix your script. Do not turn
> on "register_globals".
>
> Gordon L. Burditt
>
>
>
>> On first loading this page, you would have
>>
>> $p =
>>
>> and the button image below it.
>> On clicking the button the same page would reload but pass the hidden values

>> (r=w & p=f)
>> so that the first line of the page would then have
>>
>> $p = f
>>
>> This no longer works???
>>
>> <?php
>> echo "<html><body>";
>> echo "\$p = $p<br><br>"; //###
>> $str = <<<HTM
>> <head>
>> </head>
>> <body>
>> <form action="" 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>
>> HTM;
>> echo $str;
>> ?>
>>
>>
>> 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?
>> many thanks
>>
>> mori
>>
>>
>>
>

Try:

echo "\$p = " . $HTTP_POST_VARS['p'] . "<br><br>";


nope, doesn't work either :(


This will work, you have to set up an submit button
(javascript or nativ html to send your form data)

If you would like to have an image you should prefer JavaScript.
If a simple HTML - Button is enougth try the simple Submit Button like
in my example.
Have Fun...

<?php
echo "<html>";
echo "\$p = ".$_POST['p']."<br><br>"; //###
$str = <<<HTM
<head>
</head>
<body>
<form action="" method="post">
<input type="hidden" name="r" value="w">
<input type="hidden" name="p" value="f">
<input type="submit">
</form>
</body>
</html>
HTM;
echo $str;
?>


Did you try this wolfgang? I did and it doesn't work for me¿
Nov 28 '05 #12
"vdP" <hv**************@wanadoo.nl> wrote in message
news:43***********************@news.wanadoo.nl...
Jerry Stuckle wrote:
moriman wrote:
<form action="" 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>

How are you submitting your form? I don't see a submit button, for
instance.

I thought the same till I looked up the HTML-specification at
http://www.w3.org/TR/REC-html40/inte...ms.html#h-17.4
Apparently the input of image type serves as a submit button.

vdP


Yes, that's correct, the image acts as the submit button ;-)
Nov 28 '05 #13

"Hilarion" <hi******@SPAM.op.SMIECI.pl> wrote in message
news:dm**********@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


Nov 28 '05 #14


moriman wrote:
"Wolfgang Forstmeier" <wo*****************@gmx.de> wrote in message
news:dm**********@news.mch.sbs.de...

moriman wrote:
"Juliette" <jr*********@jokeaday.net> wrote in message
news:43***********************@news.wanadoo.nl. ..

moriman wrote:

>wow, thx for the *very* quick reply ;-)
>
>tried changing the
>echo "\$p = $p<br><br>";
>
>to
>
>echo "\$p = " . $_POST['p'] . "<br><br>";
>
>but still not working :(
>
>mori
>
>"Gordon Burditt" <go***********@burditt.org> wrote in message
>news:11*************@corp.supernews.com...
>
>
>>>The script below *used* to work. I have only just set up a
>>>server, PHP etc again on my Win98 system and now it doesn't?
>>
>>A variable passed from HTML by the POST method is $_POST['r'] or
>>$_POST['p'], *not* $r or $p. (Also see $_GET for variables
>>passed by the GET method). Fix your script. Do not turn
>>on "register_globals".
>>
>>Gordon L. Burditt
>>
>>
>>
>>
>>>On first loading this page, you would have
>>>
>>>$p =
>>>
>>>and the button image below it.
>>>On clicking the button the same page would reload but pass the
hidden
values
>
>
>>>(r=w & p=f)
>>>so that the first line of the page would then have
>>>
>>>$p = f
>>>
>>>This no longer works???
>>>
>>><?php
>>>echo "<html><body>";
>>>echo "\$p = $p<br><br>"; //###
>>>$str = <<<HTM
>>><head>
>>></head>
>>><body>
>>><form action="" 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>
>>>HTM;
>>>echo $str;
>>>?>
>>>
>>>
>>>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?

>>>many thanks
>>>
>>>mori
>>>
>>>
>>>
>>
Try:

echo "\$p = " . $HTTP_POST_VARS['p'] . "<br><br>";

nope, doesn't work either :(


This will work, you have to set up an submit button
(javascript or nativ html to send your form data)

If you would like to have an image you should prefer JavaScript.
If a simple HTML - Button is enougth try the simple Submit Button like
in my example.
Have Fun...

<?php
echo "<html>";
echo "\$p = ".$_POST['p']."<br><br>"; //###
$str = <<<HTM
<head>
</head>
<body>
<form action="" method="post">
<input type="hidden" name="r" value="w">
<input type="hidden" name="p" value="f">
<input type="submit">
</form>
</body>
</html>
HTM;
echo $str;
?>

Did you try this wolfgang? I did and it doesn't work for me�

for me this has worked perfekt ..
Nov 28 '05 #15
"Wolfgang Forstmeier" <wo*****************@gmx.de> wrote in message
news:dm*************@news.t-online.com...


moriman wrote:
"Wolfgang Forstmeier" <wo*****************@gmx.de> wrote in message
news:dm**********@news.mch.sbs.de...

moriman wrote:

"Juliette" <jr*********@jokeaday.net> wrote in message
news:43***********************@news.wanadoo.nl. ..

>moriman wrote:
>
>>wow, thx for the *very* quick reply ;-)
>>
>>tried changing the
>>echo "\$p = $p<br><br>";
>>
>>to
>>
>>echo "\$p = " . $_POST['p'] . "<br><br>";
>>
>>but still not working :(
>>
>>mori
>>
>>"Gordon Burditt" <go***********@burditt.org> wrote in message
>>news:11*************@corp.supernews.com...
>>
>>
>>>>The script below *used* to work. I have only just set up a
>>>>server, PHP etc again on my Win98 system and now it doesn't?
>>>
>>>A variable passed from HTML by the POST method is $_POST['r'] or
>>>$_POST['p'], *not* $r or $p. (Also see $_GET for variables
>>>passed by the GET method). Fix your script. Do not turn
>>>on "register_globals".
>>>
>>>Gordon L. Burditt
>>>
>>>
>>>
>>>
>>>>On first loading this page, you would have
>>>>
>>>>$p =
>>>>
>>>>and the button image below it.
>>>>On clicking the button the same page would reload but pass the


hidden
>>values
>>
>>
>>>>(r=w & p=f)
>>>>so that the first line of the page would then have
>>>>
>>>>$p = f
>>>>
>>>>This no longer works???
>>>>
>>>><?php
>>>>echo "<html><body>";
>>>>echo "\$p = $p<br><br>"; //###
>>>>$str = <<<HTM
>>>><head>
>>>></head>
>>>><body>
>>>><form action="" 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>
>>>>HTM;
>>>>echo $str;
>>>>?>
>>>>
>>>>
>>>>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?

>>>>many thanks
>>>>
>>>>mori
>>>>
>>>>
>>>>
>>>
>Try:
>
>echo "\$p = " . $HTTP_POST_VARS['p'] . "<br><br>";

nope, doesn't work either :(

This will work, you have to set up an submit button
(javascript or nativ html to send your form data)

If you would like to have an image you should prefer JavaScript.
If a simple HTML - Button is enougth try the simple Submit Button like
in my example.
Have Fun...

<?php
echo "<html>";
echo "\$p = ".$_POST['p']."<br><br>"; //###
$str = <<<HTM
<head>
</head>
<body>
<form action="" method="post">
<input type="hidden" name="r" value="w">
<input type="hidden" name="p" value="f">
<input type="submit">
</form>
</body>
</html>
HTM;
echo $str;
?>

Did you try this wolfgang? I did and it doesn't work for me?

for me this has worked perfekt ..


This is where I think the problem lies, in that there may be something in
php.ini (or elsewhere) which isn't enabled that is preventing this working
for me.

Just can't figure out what or where :(

thx
Nov 28 '05 #16
vdP wrote:
Jerry Stuckle wrote:
moriman wrote:
<form action="" 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>

How are you submitting your form? I don't see a submit button, for
instance.

I thought the same till I looked up the HTML-specification at
http://www.w3.org/TR/REC-html40/inte...ms.html#h-17.4
Apparently the input of image type serves as a submit button.

vdP


Ah, you're right. I seldom use images for submit buttons - just my
programming style (and the fact I'm a lousy artist!).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 28 '05 #17
moriman wrote:
"Hilarion" <hi******@SPAM.op.SMIECI.pl> wrote in message
news:dm**********@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.
js*******@attglobal.net
==================
Nov 28 '05 #18

"Jerry Stuckle" <js*******@attglobal.net> wrote in message
news:f-******************************@comcast.com...
moriman wrote:
"Hilarion" <hi******@SPAM.op.SMIECI.pl> wrote in message
news:dm**********@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 ( )


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Nov 28 '05 #19

"moriman" <mo*****@btinternet.com> wrote in message
news:dm**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
"Wolfgang Forstmeier" <wo*****************@gmx.de> wrote in message
news:dm*************@news.t-online.com...


moriman wrote:
"Wolfgang Forstmeier" <wo*****************@gmx.de> wrote in message
news:dm**********@news.mch.sbs.de...

>
>moriman wrote:
>
>>"Juliette" <jr*********@jokeaday.net> wrote in message
>>news:43***********************@news.wanadoo.nl. ..
>>
>>>moriman wrote:
>>>
>>>>wow, thx for the *very* quick reply ;-)
>>>>
>>>>tried changing the
>>>>echo "\$p = $p<br><br>";
>>>>
>>>>to
>>>>
>>>>echo "\$p = " . $_POST['p'] . "<br><br>";
>>>>
>>>>but still not working :(
>>>>
>>>>mori
>>>>
>>>>"Gordon Burditt" <go***********@burditt.org> wrote in message
>>>>news:11*************@corp.supernews.com...
>>>>
>>>>
>>>>>>The script below *used* to work. I have only just set up a
>>>>>>server, PHP etc again on my Win98 system and now it doesn't?
>>>>>
>>>>>A variable passed from HTML by the POST method is $_POST['r'] or
>>>>>$_POST['p'], *not* $r or $p. (Also see $_GET for variables
>>>>>passed by the GET method). Fix your script. Do not turn
>>>>>on "register_globals".
>>>>>
>>>>>Gordon L. Burditt
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>On first loading this page, you would have
>>>>>>
>>>>>>$p =
>>>>>>
>>>>>>and the button image below it.
>>>>>>On clicking the button the same page would reload but pass the

hidden

>>>>values
>>>>
>>>>
>>>>>>(r=w & p=f)
>>>>>>so that the first line of the page would then have
>>>>>>
>>>>>>$p = f
>>>>>>
>>>>>>This no longer works???
>>>>>>
>>>>>><?php
>>>>>>echo "<html><body>";
>>>>>>echo "\$p = $p<br><br>"; //###
>>>>>>$str = <<<HTM
>>>>>><head>
>>>>>></head>
>>>>>><body>
>>>>>><form action="" 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>
>>>>>>HTM;
>>>>>>echo $str;
>>>>>>?>
>>>>>>
>>>>>>
>>>>>>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?
>>
>>>>>>many thanks
>>>>>>
>>>>>>mori
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>Try:
>>>
>>>echo "\$p = " . $HTTP_POST_VARS['p'] . "<br><br>";
>>
>>nope, doesn't work either :(
>>
>>
>
>This will work, you have to set up an submit button
>(javascript or nativ html to send your form data)
>
>If you would like to have an image you should prefer JavaScript.
>If a simple HTML - Button is enougth try the simple Submit Button like
>in my example.
>Have Fun...
>
><?php
>echo "<html>";
>echo "\$p = ".$_POST['p']."<br><br>"; //###
>$str = <<<HTM
><head>
></head>
><body>
><form action="" method="post">
> <input type="hidden" name="r" value="w">
> <input type="hidden" name="p" value="f">
> <input type="submit">
></form>
></body>
></html>
>HTM;
>echo $str;
>?>
Did you try this wolfgang? I did and it doesn't work for me?

for me this has worked perfekt ..


This is where I think the problem lies, in that there may be something in
php.ini (or elsewhere) which isn't enabled that is preventing this working
for me.

Just can't figure out what or where :(


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 ;-)

thx

Nov 28 '05 #20

"moriman" <mo*****@btinternet.com> wrote in message
news:dm**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...

"Jerry Stuckle" <js*******@attglobal.net> wrote in message
news:f-******************************@comcast.com...
moriman wrote:
"Hilarion" <hi******@SPAM.op.SMIECI.pl> wrote in message
news:dm**********@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.
js*******@attglobal.net
==================



Nov 28 '05 #21
> [snip]
<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.


In some browsers - yes. Read HTML specification. Value of
"action" attribute in "form" tag is REQUIRED.

Look here:
http://www.w3.org/TR/REC-html40/inte...ms.html#h-17.3

quote:
"This attribute specifies a form processing agent. User agent
behavior for a value other than an HTTP URI is undefined."

Empty value is not a HTTP URI.

As you will also see from the OP, the data *is* being sent
As I wrote - some browsers may behave like this. Yours apparently
does behave like this (which means that the wrong value of
"action" attribute is not the cause of the problem). This does NOT
mean that all browser will, so if you want your form to be
submitable in some other browsers too, then you should specify
valid value.

[snip]
<form action="<?php echo htmlspecialchars( $_SERVER['PHP_SELF'] ); ?>"
method="post">
[snip]

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


Which means that your server configuration is somehow screwed.
$_SERVER['PHP_SELF'] should point to the URL of the script which
was originally called. Maybe some value in your php.ini suggests that
"http://home/public_html/" is your DOCUMENT_ROOT (or something like
that, I'm not sure).
Hilarion
Nov 29 '05 #22
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" <mo*****@btinternet.com> wrote in message
news:dm**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...

"moriman" <mo*****@btinternet.com> wrote in message
news:dm**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...

"Jerry Stuckle" <js*******@attglobal.net> wrote in message
news:f-******************************@comcast.com...
moriman wrote:
> "Hilarion" <hi******@SPAM.op.SMIECI.pl> wrote in message
> news:dm**********@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.
js*******@attglobal.net
==================




Dec 28 '05 #23
I don't know if you realize this, but you are using the wrong brackets on
the array $_GET['name'].
GET is used for URL variables/fields. POST is used for the other
"invisible" method of passing form fields. $_REQUEST[] will see form fields
from either method if I remember correctly.

$HTTP_POST_VARS and $_HTTP_GET_VARS are deprecated (being tossed). I have
heard someone post a complaint that it was not working in the latest PHP,
but that seems out of style with PHP's thing for compatibility - but it's a
warning nonetheless.

"Marty Meyers" <ma****@execpc.com> wrote in message
news:11*************@corp.supernews.com...
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" <mo*****@btinternet.com> wrote in message
news:dm**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...

"moriman" <mo*****@btinternet.com> wrote in message
news:dm**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
>
> "Jerry Stuckle" <js*******@attglobal.net> wrote in message
> news:f-******************************@comcast.com...
> > moriman wrote:
> > > "Hilarion" <hi******@SPAM.op.SMIECI.pl> wrote in message
> > > news:dm**********@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.
> > js*******@attglobal.net
> > ==================
>
>
>
>
>



Jan 16 '06 #24

"Jim Michaels" <jm******@yahoo.com> wrote in message
news:Xt********************@comcast.com...
I don't know if you realize this, but you are using the wrong brackets on
the array $_GET['name'].
GET is used for URL variables/fields. POST is used for the other
"invisible" method of passing form fields. $_REQUEST[] will see form fields from either method if I remember correctly.

$HTTP_POST_VARS and $_HTTP_GET_VARS are deprecated (being tossed). I have
heard someone post a complaint that it was not working in the latest PHP,
but that seems out of style with PHP's thing for compatibility - but it's a warning nonetheless.

"Marty Meyers" <ma****@execpc.com> wrote in message
news:11*************@corp.supernews.com...
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

-----snip------
Hi Jim,
Yep, a typo on my part with the wrong brackets when I created the email. I
use them correctly in the code.

The backward compatibility problem is accurate. I had to fix it because I
did not want to turn "register_globals" in php.ini 'on'.
My problem with the POST variables turned out to be a problem with the
"sitepreview" that is being used to test the new server. Someone else was
able to find the problem and got it fixed. I don't know the details yet. I
don't know what "sitepreview" is or what it involves.

I'm pretty new to web programming
Thanks
Marty

Jan 17 '06 #25

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by jfixsen | last post: by
1 post views Thread by Henry Reardon | last post: by
17 posts views Thread by Lloyd Sheen | last post: by
10 posts views Thread by Danny | last post: by
71 posts views Thread by desktop | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.