Title: Getting post data in plugin
Last modified: August 18, 2016

---

# Getting post data in plugin

 *  [nmoog](https://wordpress.org/support/users/nmoog/)
 * (@nmoog)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/getting-post-data-in-plugin/)
 * 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](https://wordpress.org/support/users/nmoog/)
 * (@nmoog)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/getting-post-data-in-plugin/#post-280877)
 * 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.

## Tags

 * [variables](https://wordpress.org/support/topic-tag/variables/)

 * 1 reply
 * 1 participant
 * Last reply from: [nmoog](https://wordpress.org/support/users/nmoog/)
 * Last activity: [20 years, 7 months ago](https://wordpress.org/support/topic/getting-post-data-in-plugin/#post-280877)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
