First of all put these all code inside in init hook, and use plugin_dir_path()
func to get plugin dir path.
add_action('init',function(){
$plugindir = plugin_dir_path( __FILE__ );
if(isset($_POST['addition'])){
$file_open = fopen($plugindir."dates.txt","w+");
fwrite($file_open, $_POST['addition']);
fclose($file_open);
}
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">
<textarea name="addition" COLS=50 ROWS=20>';
$datalines = file ($plugindir."dates.txt");
foreach ($datalines as $zz) {
echo $zz;
}
echo '</textarea><input type="submit" name="button" value="Save Evenings Before Solemnities File"></form>';
echo '</td>';
exit;
});
Try this above code.
Related Posts:
- Plugin development: how to create a form and get custom data?
- add function to saving change on Options Pages
- WP Plugins – Use includes to display page content
- Contact form 7 select box different value-text than content-text in option [closed]
- How to Add a Third Level Sub Menu to the WordPress Admin Menu
- Admin menu as submenu from another plugin
- Creating a WordPress admin page without a menu for a plugin
- Removing an admin page added by a 3rd party plugin. Gravity forms in this example
- Simple form that saves to database
- Let readers suggest edits from the frontend
- Delete option doesn’t appear for plugins
- Get selected values from checkboxes and radio buttons via Gravity Forms gform_after_submission hook [closed]
- Adding an admin page – OOP approach not working
- Generate Advanced Custom Fields box in custom admin menu page
- Where should my plugin POST to?
- Multi step form, custom plugin
- Master menu item for multiple plugins?
- shortcode doesn’t work
- Contact Form 7 plugin refreshing page on submit [closed]
- Template plugin for blog posts? [closed]
- Plugin form unable to process
- How to make a WP admin button/menu similar to Jetpack Notifications?
- Trying to add admin file upload form plugin
- wp_verify_nonce() why return false?
- Detecting when a custom taxonomy has been changed and display alert?
- How to disable autocomplete for inputs in contact form 7? [closed]
- Sub menu with a URL parameter and access the page
- Removing WordPress Plugin Menu Item for a specific user
- WordPress Custom Application form
- When is it useful to use wp_verify_nonce
- Datepicker not supporting timepicker
- Is there any good tutorial to write custom login, registration and password recovery forms? [closed]
- Change the $parent_file of a plugin page
- WordPress plugin form not saving data
- Admin page: form with enctype=”multipart/form-data” does not transfer its data
- reorder plugin menu position
- How do I remove the entire left nav bar in admin for certain level users?
- jQuery Plugin to use WordPress functions in AJAX request
- Hide Theme options and Customize Admin menu
- How to send little data between admin pages of my plugin?
- Add form fields dynamically on button click
- how can I link to a PlugIn admin-sub-menu page after processing a formular
- How to trigger $_GET request within admin plugin page?
- Retrieving a Value from a wp-database
- Custom CSS for plugin form
- Form doesn’t submit on second submit call
- WP plugins for building a database?
- Hook into and send mail using WP Mail SMTP type plugin from HTML static front page?
- Custom form action to handle data inside a plugin
- White page on custom plugin option submit
- Make menu page link inaccessible or disabled
- wp_create_nonce function doesn’t work inside a plugin?
- Form isn’t inserting data into database with ajax plugin
- New User Form – Custom Menu Page
- Image upload and other options in the same plugin settings form?
- When using Simple Fields plugin, how do I pull the information out of the database to display on a page?
- Anonymous Postings
- Creating an online questionnaire form – by Importing the questions from a spreadsheet?
- Can I use custom CSS and js plugin to put JavaScript in to validate my forms
- Using a custom plugin to capture input data via Ajax and PHP
- auto populate list of questions if user select a category xyz
- WordPress WPforms customization
- Contributive page where people logged in can write
- Contact Form 7 Get Image Function [closed]
- Show existing POST categories as items in the sidebar menu [closed]
- Polylang : Interverting languages after development [closed]
- Submit page limited in time to upload image
- Adapt PHP form action for WordPress?
- Is there any way to use google input tool or any other language keyboard with WordPress [closed]
- Ajax fail and get 504 error
- Take input from form and pass it to function using a wp-plugin
- Checkbox conflict in my custom plugin admin page
- How to insert HTML/JavaScript form into WordPress page? [closed]
- Trying to fix form resubmition with PRG (Getting error: Cannot modify header information – headers already sent by)
- Suggestions on Approach to New Plugin I’m Stuck On
- How do I make a child theme I made POST through a 3rd party plugin?
- Dynamic admin submenu
- How to fetch form data and show it to my page?
- Plugin to create forms using HTML [closed]
- Submit custom form from post content and execute in plugin
- How to allow user to select User ID in Formidable Pro form? [closed]
- Char limit on custom blog-post form? [closed]
- Add menu page issues (permissions & position)
- How to use add_submenu_page() for editors?
- AJAX fileupload – TypeError: not a function ajaxSubmit()
- Is there a way to embed a Google Docs form in a page without using plugins?
- What’s causing this error? “Warning: Invalid argument”
- Detailed form plugin, with ability to export to excel etc. OR edit PDF live? [closed]
- easy steps to make front end form without plugin
- Form that generates an ID for the customer
- Move plugin-settings to ‘Settings’-menu in the admin
- Submit Form data to another page via Ajax (WordPress Way)
- WordPress Admin Menu defining function is seperate file
- Ajax Plugin Not Echoing Response
- creating a plug in that would tap into save/update action of posts [closed]
- Plugin that will output submitted form data for user? [closed]
- How to handle forms from sidebar widgets – Processing $_POST variables using get_field_name()
- Display Plugin Panels Outside of Admin Areas
- How do I add the same contact form to multiple wordpress sites and capture the response in one place or database?
- Why WP_Screeen doesn’t show all options with admin_body_class