milov.nl

Interaction design • webdevelopment • web art • photography

milov.nl : forum : coding : 'POST method in PHP working strangely'

POST method in PHP working strangely laposte.net,olivier.laxenaire,laxenai, 040504 14:50
Hello,

I am using a Linux Red Hat OS + PHP 4.3.0 + Apache

I got a problem with HTML form and PHP POST method wich work strangely.

<form action="b.php" method="post">
<input name="entry1" type="text">
<input value="GO" type="submit">
</form>

In the 'b.php' script i do :
<?
echo "\$_POST['entry1'] = {$_POST['entry1']} <br>";
?>

the result is (i typed '42' as the value to display) :
$_POST['entry1'] = 42Entry1=42; //it glues both variable name+value

It does works well with GET method, but not with POST. The phpinfo() method shows that the _POST variable =>'42Entrey1=42'<= and that the QUERY_STRING variable is empty (wich is not true with the GET method wich works properly)...

What's wrong ?
Thank you
ASte-Genev-Bois-112-1-1-199.w80-15.abo.wanadoo.fr
Re: POST method in PHP working strangely aaron, 050419 06:57
I'm not quite sure what you've got going on in your b.php, try this:

<?
echo "$_POST['entry1']<br>";
?>

The PHP interpreter will replace $_POST['entry1'] with the actual value, so your output page will display "42<br>" (assuming 42 is your input)
208.50.82.11
Re: POST method in PHP working strangely Calm_Pear, 050419 23:19
That's strange... this morning there was an answer by Milo indicating something with curly brackets...{}
where did that go? (the very old post)
h103091.upc-h.chello.nl
Re: POST method in PHP working strangely Milo, 050420 08:46
I removed it; it was possibly incorrect advice.
milov.demon.nl
Re: POST method in PHP working strangely Calm_Pear, 050420 10:06
aha... I snap
h103091.upc-h.chello.nl
Pages: 1