Magento 2 Set $_POST to an empty Array()getFormAction() returns empty stringMagento does not pass empty varible in POST datasaveAction stores empty objectMagento 2 simple form submitmagento 2 get empty post array in version 2.0.5Array to string conversion in Magento 2Magento 2 | Get Post ParamsMagento 2 ui form multiselect field not checked not in $_POSTDirect use of $_FILES Superglobal detected. In magento 2Magento 1.9.2 - getRequest()->getParams returning with empty array

Why didn't Balak request Bilam to bless his own people?

Do gauntlets count as armor?

What is the difference between uniform velocity and constant velocity?

How to tell readers that I know my story is factually incorrect?

How can electronics on board JWST survive the low operating temperature while it's difficult to survive lunar nights?

Why should fork() have been designed to return a file descriptor?

Why didn't NASA launch communications relay satellites for the Apollo missions?

What does a Nintendo Game Boy do when turned on without a game cartridge inserted?

Improving an O(N^2) function (all entities iterating over all other entities)

Satellite in orbit in front of and behind the Moon

Can two waves interfere head on?

ISCSI, multiple initiaros for the same lun

When will the last unambiguous evidence of mankind disappear?

Killing a star safely

What does "play in traffic" mean?

Conditional statement in a function for PS1 are not re-evalutated

Why can't a country print its own money to spend it only abroad?

Why does Plot only sometimes use different colors for each curve

What is this light passenger prop airplane which crash landed in East Kalimantan, Borneo in 1983?

What is the origin of "Wonder begets wisdom?"

She told me that she HAS / HAD a gun

Redirection operator, standard input and command parameters

You have no, but can try for yes

How much did all the space agencies spent on rockets launching and space exploration? What are the benefits for me and you?



Magento 2 Set $_POST to an empty Array()


getFormAction() returns empty stringMagento does not pass empty varible in POST datasaveAction stores empty objectMagento 2 simple form submitmagento 2 get empty post array in version 2.0.5Array to string conversion in Magento 2Magento 2 | Get Post ParamsMagento 2 ui form multiselect field not checked not in $_POSTDirect use of $_FILES Superglobal detected. In magento 2Magento 1.9.2 - getRequest()->getParams returning with empty array






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I can't seem to find a way to set $_POST to an empty array.



I have a form in phtml action to self I can get $_POST values the following ways:



$this->getRequest()->getPostValue('form_key');

$this->getRequest()->getParam('form_key');


The Above will give Array ( [form_key] => FThdknnc_347djcncKey_)



Now I've tried to reset by doing:



$this->getRequest()->setPostValue('form_key');


But it gives me:



Array ([form_key] =>)


That ain't right browser still popping up saying that it will resend data from form: It should return Array () But the form_key key is still in the $_POST Array. one can do in php:



$_POST = Array(); and that would be enough but it doesn't work with magento.



Anyone any idea?










share|improve this question




























    3















    I can't seem to find a way to set $_POST to an empty array.



    I have a form in phtml action to self I can get $_POST values the following ways:



    $this->getRequest()->getPostValue('form_key');

    $this->getRequest()->getParam('form_key');


    The Above will give Array ( [form_key] => FThdknnc_347djcncKey_)



    Now I've tried to reset by doing:



    $this->getRequest()->setPostValue('form_key');


    But it gives me:



    Array ([form_key] =>)


    That ain't right browser still popping up saying that it will resend data from form: It should return Array () But the form_key key is still in the $_POST Array. one can do in php:



    $_POST = Array(); and that would be enough but it doesn't work with magento.



    Anyone any idea?










    share|improve this question
























      3












      3








      3








      I can't seem to find a way to set $_POST to an empty array.



      I have a form in phtml action to self I can get $_POST values the following ways:



      $this->getRequest()->getPostValue('form_key');

      $this->getRequest()->getParam('form_key');


      The Above will give Array ( [form_key] => FThdknnc_347djcncKey_)



      Now I've tried to reset by doing:



      $this->getRequest()->setPostValue('form_key');


      But it gives me:



      Array ([form_key] =>)


      That ain't right browser still popping up saying that it will resend data from form: It should return Array () But the form_key key is still in the $_POST Array. one can do in php:



      $_POST = Array(); and that would be enough but it doesn't work with magento.



      Anyone any idea?










      share|improve this question














      I can't seem to find a way to set $_POST to an empty array.



      I have a form in phtml action to self I can get $_POST values the following ways:



      $this->getRequest()->getPostValue('form_key');

      $this->getRequest()->getParam('form_key');


      The Above will give Array ( [form_key] => FThdknnc_347djcncKey_)



      Now I've tried to reset by doing:



      $this->getRequest()->setPostValue('form_key');


      But it gives me:



      Array ([form_key] =>)


      That ain't right browser still popping up saying that it will resend data from form: It should return Array () But the form_key key is still in the $_POST Array. one can do in php:



      $_POST = Array(); and that would be enough but it doesn't work with magento.



      Anyone any idea?







      forms magento2.2.2 post-data






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jul 12 at 11:11









      Juliano VargasJuliano Vargas

      7376 silver badges26 bronze badges




      7376 silver badges26 bronze badges




















          2 Answers
          2






          active

          oldest

          votes


















          1














          Try this:



          /** @var ZendStdlibParametersInterface $postParameters */
          $postParameters = $this->getRequest()->getPost();
          $postParameters->fromArray([]);


          Use getQuery method to clean GET parameters.






          share|improve this answer






























            0














            You can try like this,



            $formKey = $this->getRequest()->getPostValue('form_key');

            unset($formKey);


            than after you can try to set again



            $this->getRequest()->setPostValue('form_key','your_value');


            Hope it helps.






            share|improve this answer

























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "479"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f281879%2fmagento-2-set-post-to-an-empty-array%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              Try this:



              /** @var ZendStdlibParametersInterface $postParameters */
              $postParameters = $this->getRequest()->getPost();
              $postParameters->fromArray([]);


              Use getQuery method to clean GET parameters.






              share|improve this answer



























                1














                Try this:



                /** @var ZendStdlibParametersInterface $postParameters */
                $postParameters = $this->getRequest()->getPost();
                $postParameters->fromArray([]);


                Use getQuery method to clean GET parameters.






                share|improve this answer

























                  1












                  1








                  1







                  Try this:



                  /** @var ZendStdlibParametersInterface $postParameters */
                  $postParameters = $this->getRequest()->getPost();
                  $postParameters->fromArray([]);


                  Use getQuery method to clean GET parameters.






                  share|improve this answer













                  Try this:



                  /** @var ZendStdlibParametersInterface $postParameters */
                  $postParameters = $this->getRequest()->getPost();
                  $postParameters->fromArray([]);


                  Use getQuery method to clean GET parameters.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 12 at 12:11









                  Evgeny LevinskyEvgeny Levinsky

                  9251 gold badge4 silver badges11 bronze badges




                  9251 gold badge4 silver badges11 bronze badges























                      0














                      You can try like this,



                      $formKey = $this->getRequest()->getPostValue('form_key');

                      unset($formKey);


                      than after you can try to set again



                      $this->getRequest()->setPostValue('form_key','your_value');


                      Hope it helps.






                      share|improve this answer



























                        0














                        You can try like this,



                        $formKey = $this->getRequest()->getPostValue('form_key');

                        unset($formKey);


                        than after you can try to set again



                        $this->getRequest()->setPostValue('form_key','your_value');


                        Hope it helps.






                        share|improve this answer

























                          0












                          0








                          0







                          You can try like this,



                          $formKey = $this->getRequest()->getPostValue('form_key');

                          unset($formKey);


                          than after you can try to set again



                          $this->getRequest()->setPostValue('form_key','your_value');


                          Hope it helps.






                          share|improve this answer













                          You can try like this,



                          $formKey = $this->getRequest()->getPostValue('form_key');

                          unset($formKey);


                          than after you can try to set again



                          $this->getRequest()->setPostValue('form_key','your_value');


                          Hope it helps.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jul 12 at 12:22









                          Mohit RaneMohit Rane

                          77416 bronze badges




                          77416 bronze badges



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f281879%2fmagento-2-set-post-to-an-empty-array%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                              Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                              Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?