I think the easiest way is adding the form via the Shortcode API. The code would look like this:
function myform_handler( $atts ){
if (isset(@$_REQUEST['submit'])) {
//Do something
} else {
$return = '<form action="" method="post">
<input type="text" name="myfield">
<input type="submit" name="submit>
</form>';
}
return $return;
}
add_shortcode( 'myform', 'myform_handler' );
Then you can add on any page the following Shortcode, that creates the form (and the form’s response):
[myform]
Related Posts:
- Char limit on custom blog-post form? [closed]
- How to handle forms from sidebar widgets – Processing $_POST variables using get_field_name()
- Can’t edit Contact Us form on front page
- How can I add a zip code service availability checker in WordPress without Woocommerce? [closed]
- Between functions.php (theme), widgets, and plugins, which is loaded first?
- Adding a widget programmatically
- Override dynamic_sidebar() in plugin?
- Is dynamic forms/entries possible in Widget?
- Pages with 2 Columns
- Custom Widget Creating PHP Exception When Placed In Its Own PHP File
- register child class in another plugin
- shortcode doesn’t work
- Template plugin for blog posts? [closed]
- Conditional Display of Links in Widgets
- How to Get Admin Settings for a widget when using the_widget() with custom widget
- WordPress multiple widget in single plugin
- Created Widget Not Showing up on Admin Panel
- Setting up widgets in wordpress with a unique ID for the after_title argument
- Admin Dashboard with Custom Tab for Client
- WordPress author details plugin/widget
- WAMP to XAMPP WordPress transfer
- Custom form action to handle data inside a plugin
- The plugin generated 3 characters of unexpected output during activation
- wp_create_nonce function doesn’t work inside a plugin?
- Multi language site [closed]
- How to style the RSS wordpress?
- How can I disable widget from being visible on some pages?
- How to display more than one instance for a widget?
- Custom random quote widget breaks when used in multiple sidebars
- Hooking in to replace the Sidebar/Widget areas
- How to hide CSS by default and show on button press
- Submit page limited in time to upload image
- Ajax fail and get 504 error
- Widgets Scripts don’t load – but load when I reload the page
- Trying to fix form resubmition with PRG (Getting error: Cannot modify header information – headers already sent by)
- How to add wp visual editor in a custom widget?
- WordPress Widget – Saving multidimensional arrays into $instance
- Custom plugin appears outside of the sidebar container
- How do I use wp_editor() in widget form?
- How to reorder and display a feed to be chronological?
- Hide certain widgets from specific user roles in admin
- How do I find out what is in control over a certain part of a website?
- Is there a way to embed a Google Docs form in a page without using plugins?
- Best practice for including plugin output in a template without using shortcode?
- Submit Form data to another page via Ajax (WordPress Way)
- Custom widget doesn’t save values from dropdown box
- Register Script in Plugin Widget
- Add Shortcode tag in Widget/Sidebar
- How to create wordpress widget that is fixed position on the home page
- jQuery Click event is not fired at all
- Creating a form and displaying entry data as a table
- Widget for specific category
- get_term_meta returns false in widget
- Custom form not showing in correct place on page
- Call another page in forms
- How to Use the Filter “sidebar_login_widget_form_args”
- Select Form Element Not Saving from Plugin Options
- My widget won’t update its values when save is clicked
- Contact Form 7 Plugin emails not being received by some accounts
- Extend a plugin to include a widget option
- Is there a Image Gallery which will load all my posted Images like twitter’s image grid?
- Table of contents (TOC) plugin is not showing header tag
- User loggedin as Subscriber form not sending
- How to fetch WordPress database values in JavaScript widget
- How to get data from a form on a wordpress site?
- What is the right way to populate a dropdown from MySql?
- 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?
- How to send custom mail when a user complete a specific form
- How to submit custom form data using ajax to HubSpot form?
- Pause form submissions while upgrading plugins
- How to display widget in front end?
- Widget outputs the value but doesn’t save anything inside the textarea
- WordPress Widget: Is it possible to make the form dynamic without updating?
- How to hide the form after successful php execution
- Using Widget Logic to place menu on multiple pages?
- 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
- Include plugin form in the home page
- Show widget location borders for development
- Cannot access variables within a widget
- How can i see/log all requests coming from a registration form (not from the UI)?
- Form submit from wordpress plugin
- adding image in the header of my dev widget
- How do I convince this button to do something when it is clicked?
- Linking Plugin Files to WP
- Plugin: Unable to Save the Image Alignment Option to Display in the Widget in the Sidebar
- Carrying information from button click into form [closed]
- County Finder form/plugin?
- How to add homepage Widget?
- What can I do to customize a widget provided with this plugin? from where have I to start?
- Is it possible to set different payment gateway on each Gravity Forms form? [closed]
- Content expands beyond its column container [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?
- Am having issues intergrating this api into my wordpress site, any help please?
- Form with response button after on table after submission
- Tips on using a custom template with Ultimate Member
- Can’t save formdata in DB