Send variables by $ _POST in wordpress

0

I am doing a module for a site in wordpress and I need to send data from one form to another PHP file, but if I try to do it in the traditional way I do not receive the variables for $ POST

(this is my form)

  <form id="formRespuesta" method="POST" action="http://localhost/refaplaza/action/">
        <div><b>Te realizaron la siguiente pregunta: </b></div>
        <div id="pregunta"></div><br>
        <div><b>Respuesta Max. 250 caracteres</b></div>
        <textarea rows="10" cols="60" maxlength="250" id="answer" name="answer"></textarea><br></div>
  <div class="modal-footer">
    <button type="submit" class="btn btn-primary" >Responder</button>
    <button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
    </form>

(file where I send the variables)

$answer= $_POST["answer"];

/**
 * The Template for displaying all single posts.
 * Template Name: action
 * @package _bootstraps
 * @package _bootstraps - 2013 1.0
*/

get_header();


?>

<div id="primary" class="content-area col-md-9">
    <div id="content" class="site-content" role="main">

        <?php 

        echo "answer= ".$answer."<br>";

        ?>

    </div><!-- #content .site-content -->
</div><!-- #primary .content-area -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

But when I try to print the variable $answer it does not bring me anything, as if the $ POST method did not work

Any idea how I can send the variables of the form for $ POST?

    
asked by L. Diaz 27.10.2017 в 16:36
source

1 answer

2

You are not specifying the name of the php file to which you are sending it.

For example:

 action="http://localhost/refaplaza/action/xxxx.php">

Review how to work with forms. link

    
answered by 27.10.2017 в 18:50