Monday, April 22, 2019

php - Sending form with POST method and Polymer iron-form?



i use Polymer starter kit 1.0.2 and i'm trying to use iron-form based on (little) documentation i found.




My method form is "post" and contain only one input.



My form "action" is a PHP script (add.php) showing content of $_GET and $_POST:



print_r($_POST);
print_r($_GET);


My form component (form_eclp.html) is:











I call if from:







When i click the submit button after entering the text 'test' in name input, i can see in the network tab of the browser developper tools that it's a POST request, ok, but the url is add.php?name=test, and in the response tab i have:




Array
(
)
Array
(
[name] => test
)



According to my form action (add.php script), first array is for $_POST and the second $_GET.



I can see, despite form method="post", it's a "get" request because only $_GET is populated, there is nothing in $_POST.



I don't understand, is it a bug ?


Answer



So it seems like the form-input is outdated in your bower.json. Do this: bower install -S PolymerElements/iron-form and everything should be fine.


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...