You could put both the form and processing logic in the same file and submit the form to the same page by omitting the action attribute. Check $_POST vars to see if the form has been submitted and do your processing, otherwise display the form.
if( isset( $_POST['somevar'] ) ) :
// process submission
else :
// show form
endif;
Related Posts:
- php – Plugin/theme relative PATH/URI
- wordpress admin part is not accesbile after server shifting
- Apply function.php filter only if url not has /amp/
- How to route root path / to /xyz in nginx?
- I can’t load my images from a js file using wp_localize_script
- Right path for renaming a file in uploads folder
- How to add a .php file to WordPress
- When to use Exceptions vs Error Objects vs just plain false/null
- Woocommerce get selected shipping zone id for the current user
- Include files in functions.php
- Display all meta for a post?
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- Add to previous posts under post
- How to show order data by multiple ID?
- Print html when custom field has value inside while loop
- how to create and show sessions in word press?
- Categories Template Assistance
- Stop Duplicating Terms in a Foreach Loop
- Generating add_settings_section() calls dynamically
- How to trash multiple post/product programmatically
- Loading jQuery in the footer after removing jQuery migrate?
- Proper way to edit a post via phpMyAdmin without breaking the compare revisions tool
- Sending jsPDF documents to the server
- Unit Test in WordPress
- “before delete post” action fire when the post is updated?
- Register non hierarchical taxonomy and the show meta box in the post type
- Admin username and password
- WordPress excerpt not working
- Random Default Avatar Function
- Custom Text in WooCommerce Order Processing Email Based on Products
- Redirect to another page after submission using wp_mail
- Loop with slider (slider not loading)
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- Error when adding excerpt to the content through functions.php
- wordpress media library new uploads don’t write to database
- Add data attribute to each li in menu
- Fresh Install WP error – “The site is experiencing technical difficulties” [closed]
- Woocommerce : Can’t get product info in loop
- inserting a post from an extern php file but post content doesn’t show on wp site
- Way to add captions to gallery images by code
- Echo possibly causing custom template formatting conflict
- proper way to add css using functions.php?
- How do I create my own .php file with a code part and echo it on different pages?
- “Undefined index” error when saving empty array with checkboxes
- Conditional using get_the_ID() not working [closed]
- WordPress plugin admin page – using WordPress function in linked php file
- How to fix this PHP warning in WP-Admin after upgrading to 3.1.2?
- if isset not working for undefined index, how to fix
- Decoded malware code [closed]
- PHP Notice: Undefined offset: -1 – Navigation Previous/Next
- Where is the PHP code generating an element?
- How do I check or test a WordPress Auto Year Change Script?
- Prevent redirect to wp-login.php
- Trying to enqueue script – Nothing Happens
- Undefined offset: 0-wp-includes/meta.php:488 -Melding
- WordPress and PHP Version Upgrade issue [closed]
- How can I get my Media Uploader Button to function on 1 click rather than requiring 2 clicks?
- Images Uploaded saving onto older/previous year folders
- PHP Redirect condition
- WordPress 4.2.3 on Windows Server 2008 R2 Creating Files as read only
- WooCommerce “Checkout Now” button [closed]
- Woocommerce getting top level category parent and make all sub categories have the same template and menu
- Defining multiple categories for showing latest posts
- Finding and removing duplicates within WP Arrays
- Hard-coding a shortcode as the last menu item in primary navigation?
- Removal of all posts content in bulk, keeping the posts itself
- Blog suddenly shows Archive instead of index page
- Is it possible to access admin-ajax.php using PHP?
- Loading Elementor templates in a Bootstrap modal on button clicking
- Adding custom field to product category and show it to shop/category shop page
- How to check if is page template inside functions.php
- How to hide a div section when user is logged in, in single product woocommerce
- REST API custom endpoint to fetch pages and posts not working
- display custom plugin view on front end inside template body
- Wp redirect – reset password
- How do I get data from my database into my Custom Export Field
- Fix hover images blink
- How to auto-generate random numbers in username?
- How to add a custom class for iframe by embed_oembed_html
- Generate random access token to a post page
- Filter loop by ‘price’ with meta_query
- remove public static function wp_link_dialog()
- Find the method which AJAX GET calls
- Adding button to wordpress menu
- List users in a dropdown for login
- WordPress pagination broken on blog page, working for search results page
- How do I / Is it possible to execute an external PHP file / function inside WordPress?
- wp_get_archive for category returning different URLs on different but similar sites
- Widget header unique classes
- Trouble using wordpress functions in a pop-up modal form
- reorder a WP_Query, using a dropdown
- Select area and checkbox data is not saving?
- Suppress errors when using global function
- In reading settings posts are set to “blog” and I have page-blog.php but no posts
- using a shortcode in a hyperlink
- Redirect loop upon installation of my plugin
- Find owner of coupon
- PHP Works only for logged in users: [closed]
- WordPress wp_remote_request() – How to do async await in wordpress php?
- How Create Automatically Image jpg.webp from image .jpg without delete or change original images upload