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]
- Creating a WordPress admin page without a menu for a plugin
- Simple form that saves to database
- Master menu item for multiple plugins?
- shortcode doesn’t work
- Template plugin for blog posts? [closed]
- 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
- Is there any good tutorial to write custom login, registration and password recovery forms? [closed]
- reorder plugin menu position
- Hide Theme options and Customize Admin menu
- How to send little data between admin pages of my plugin?
- 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
- wp_create_nonce function doesn’t work inside a plugin?
- New User Form – Custom Menu Page
- Anonymous Postings
- Using a custom plugin to capture input data via Ajax and PHP
- 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]
- Submit page limited in time to upload image
- Ajax fail and get 504 error
- Checkbox conflict in my custom plugin admin page
- Trying to fix form resubmition with PRG (Getting error: Cannot modify header information – headers already sent by)
- Dynamic admin submenu
- How to fetch form data and show it to my page?
- Submit custom form from post content and execute in plugin
- 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?
- easy steps to make front end form without plugin
- Submit Form data to another page via Ajax (WordPress Way)
- Ajax Plugin Not Echoing Response
- How to handle forms from sidebar widgets – Processing $_POST variables using get_field_name()
- Display Plugin Panels Outside of Admin Areas
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- add_submenu_page returns null
- Creating a form and displaying entry data as a table
- How do I add an options page at the bottom of the list?
- How to remove a CPT Menu from the Root Admin only
- Storing The Data Collected by Ninja Forms into Another (custom) Database [closed]
- Show WordPress Plugin Menu(Admin) To Editor
- Add logo to admin menu in my plugin
- Custom form not showing in correct place on page
- Form Plugin for Api Requests which is used via Shortcode
- Call another page in forms
- Echo out element to another page.
- How to Use the Filter “sidebar_login_widget_form_args”
- Select Form Element Not Saving from Plugin Options
- Contact Form 7 Plugin emails not being received by some accounts
- Using AJAX to run SQL statement and populate dropdown
- Looking for a simple checkout plugin [closed]
- Adding custom Field To The Posts Listing
- get wpforms ID value from ACF text field
- User loggedin as Subscriber form not sending
- How to create a form where you can select multiple recipients, based on a list of website users?
- Creating an admin button that when clicked shows a popup form
- WordPress search input in database, to edit information via form and update the database
- How to get data from a form on a wordpress site?
- WPForms Custom Redirect not working
- add menu page not showing Icon
- General Term for this form Field
- Why is my form going to frontend on html form submission present on the php files inside my custom plugin?
- Custom Icon assigned to menu items not working for multi-site networks
- Admin menu hilighting wrong item for CPT
- How to send custom mail when a user complete a specific form
- How to submit custom form data using ajax to HubSpot form?
- Creating Admin Submenu Page via Class Method
- Pause form submissions while upgrading plugins
- How to hide the form after successful php execution
- How can I automatically send an email with an excel file containing submissions for a form rather than an email per submission?
- Why doesn’t a form need an ‘action’ with a plugin that uses the post data?
- $POST variable is empty in receiving php add-on function but can be seen by jscript function
- Plugin option for input box validation
- Include plugin form in the home page
- How can i see/log all requests coming from a registration form (not from the UI)?
- Form submit from wordpress plugin
- How to add submenu to WordPress plugin in the same Directory of main Plugin?
- Assigning a custom post type to a custom page
- Saving custom form fields
- How do I convince this button to do something when it is clicked?
- How can I pass value to function in add_menu_page?
- Linking Plugin Files to WP
- Adding a Filter to Sidbar Login Plugin to Change Login Button Lable
- Carrying information from button click into form [closed]
- County Finder form/plugin?
- Undefined variable _POST
- How to develop an extension for a simple form post and post back? [closed]
- Is it possible to set different payment gateway on each Gravity Forms form? [closed]
- how to show selected options drop down menu values in attributes field in after saving post.php
- How to Allow Users to Select Recipients In a WordPress Comment section?
- Form with response button after on table after submission
- Tips on using a custom template with Ultimate Member
- How can I add a zip code service availability checker in WordPress without Woocommerce? [closed]
- Can’t save formdata in DB