lundi 23 mars 2015

php form empty unless refresh resubmit

I have read many many many posts on this topic but none seem to address my particular problem.


I have removed all php and html from my form and striped it back to the bare minimum to eliminate coding mistakes.



<form action="/profilesave.php" method="post">
<input type="text" name="a" />
<input type="text" name="b" />
<input type="text" name="c" />
<input type="text" name="d" />
<input type="text" name="e" />

<input type="submit" >
</form>


profilesave.php



<?php $data = file_get_contents('php://input'); ?>
<?php var_dump($data);?>
<?php var_dump($_POST);?>


Result:



string '' (length=0)


array (size=0) empty



However if I hit refresh on the page I get:



string 'a=test&b=test&c=test&d=test&e=test&f=test&g=test&h=test' (length=55)


array (size=8)

'a' => string 'test' (length=4)

'b' => string 'test' (length=4)

'c' => string 'test' (length=4)

'd' => string 'test' (length=4)

'e' => string 'test' (length=4)

'f' => string 'test' (length=4)

'g' => string 'test' (length=4)

'h' => string 'test' (length=4)



Can anyone tell me please what am I doing wrong?


Thanks.


Aucun commentaire:

Enregistrer un commentaire