• Ive been messing around with making plugins, but I’m not primarily a php programmer. I’m trying to get the form data from the plugin-editor.php page in the plugin itself:


    add_action('init', 'one');
    add_action('admin_head', 'two');

    $formField = "";

    function one()
    {
    global $formField;
    $formField .= $_POST['file'];
    //echo "one:" . $formField;
    }

    function two()
    {
    global $formField;
    echo "two:". $formField;
    }

    If I echo out the $formField variable in the first function (init) then it has the correct field value. But How can I then assign that value to a variable that is accessible when I get to the second function (admin_head).

    If I do echo $_POST[‘file’] in the admin_head it returns no value.

    Thanks,

    nmoog

Viewing 1 replies (of 1 total)
  • Thread Starter nmoog

    (@nmoog)

    Ok, this one has me totally stumped – am I just not understanding the post loop or something?! If function one() echos the correct form value, how come I cant keep it in a variable for later?

    If its not possible to do this, how can I use actually submitted form data (such as the file in the plugin-editor.php page) inside my plugin?

    Thanks!

Viewing 1 replies (of 1 total)

The topic ‘Getting post data in plugin’ is closed to new replies.