Just echo the javascript out inside the if function
<form name="testForm" id="testForm" method="POST" > <input type="submit" name="btn" value="submit" autofocus onclick="return true;"/> </form> <?php if(isset($_POST['btn'])){ echo " <script type=\"text/javascript\"> var e = document.getElementById('testForm'); e.action='test.php'; e.submit(); </script> "; } ?>
Related Posts:
- How to pop an alert message box using PHP?
- Reactjs – Form input validation
- Angular: mat-form-field must contain a MatFormFieldControl
- No value accessor for form control
- Send POST data using XMLHttpRequest
- Setting onSubmit in React.js
- jQuery AJAX submit form
- How do I embed PHP code in JavaScript?
- How to use php code in javascript
- How to reset a form using jQuery with .reset() method
- How do I pass variables and data from PHP to JavaScript?
- Execute PHP function with onclick
- JavaScript post request like a form submit
- Mixed Content Page: requested an insecure stylesheet error
- How to create a HTML Cancel button that redirects to a URL
- What does ngf-select do and why is it needed for form validation?
- SyntaxError: Unexpected token C in JSON at position 0 – Ionic 2 Http GET request
- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
- JavaScript post request like a form submit
- is there something like isset of php in javascript/jQuery?
- How can I get form data with JavaScript/jQuery?
- how to call a onclick function in tag?
- How do I refresh a DIV content?
- Only on Firefox “Loading failed for the script with source”
- How to open a URL using PHP?
- {“error”: “Please use POST request”} – alternative solution to submitting a form
- Keep getting a “Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup” when attempting to google plus login on my web app
- FormData append not working
- JavaScript code to stop form submission
- Ajax success function
- AngularJS POST Fails: Response for preflight has invalid HTTP status code 404
- ngular is automatically adding ‘ng-invalid’ class on ‘required’ fields
- WordPress Bootstrap Handburger Menu Wont Open
- Add custom form to theme
- How to replace a javascript select box onchange event to a form submit action?
- Custom WordPress+PHP+MYSQL+AJAX form, submit event not captured by Javascript, but does POST data to the DB
- How do I embed a Javascript form directly into a page?
- How to load javascript file on homepage in WordPress in order?
- How to pre populate a form field with a link of a current user’s author profile?
- How to insert HTML/JavaScript form into WordPress page? [closed]
- AJAX not Working with php as supposed
- How do you filter the list of states when country is selected? [closed]
- Uncaught ReferenceError: jQuery is not defined – although jQuery is loaded [closed]
- Why does a on Comment edit page submit the page?
- How to add “on change” to a text input in contact form7?
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- Getting a variable inside foreach from PHP to JS after localization
- Add captcha validation to my custom form for Frontend posting
- How to add a onclick attribute to a list of checkboxes?
- Close modal window after form submit [closed]
- Testing a Form’s Zipcode Field with Regular Expressions to Determine WordPress Page Behaviour
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- Cascading dropdown select search based on Parent Page & Child Page
- Form will not popup, when clicking on the link to the form
- How to show cities according to the state in Form using Javascript? [closed]
- Can’t Listen to KeyDown in TInyMCE Iframe (jQuery) and Pass it to Parent HTML FORM
- Javascript / PHP – closing the loop
- Error handling for wpdb error – displaying an error message to the user
- Open image gallery on link click
- How to change number field to text field using JS
- How do I convince this button to do something when it is clicked?
- how to show selected options drop down menu values in attributes field in after saving post.php
- CCF7 Field numbuer prefilled after Click event
- Sending GravityForms to custom HTML
- Understanding unique keys for array children in React.js
- Is there a difference between /\s/g and /\s+/g?
- How to read an external local JSON file in JavaScript?
- Form submission: PHP S_SESSION statements within a foreach loop
- How do I chop/slice/trim off last character in string using Javascript?
- What is causing this error – “Fatal error: Unable to find local grunt”
- Escape quotes in JavaScript
- “Uncaught (in promise) undefined” error when using with=location in Facebook Graph API query
- What is ESNext?
- SyntaxError: Cannot use import statement outside a module
- jQuery disable/enable submit button
- Uncaught Invariant Violation: Too many re-renders. React limits the number of renders to prevent an infinite loop
- How to read if a checkbox is checked in PHP?
- Why is marquee deprecated and what is the best alternative?
- SyntaxError: Use of const in strict mode
- Check if url contains string with JQuery
- Should a WordPress plugin polyfill the global JS environment?
- Running JS after theme customizer finished initialization
- woocommerce registration form with klaviyo(don’t work with current user)
- Help display image in single post using javascript zoom image..?
- Checks when fetching data from multiple REST API endpoints in Gutenberg
- How to get the title of the item that is clicked on
- Search Query: how to construct a search string from two select elements?
- Correct way to include extra styles & script files?
- How can I allow HTML in Gutenberg UI elements help text?
- UnitControl – Block has encountered an error
- JS file is not loading when i put wp_head() and wp_footer
- Additional file upload in Gutenberg page options/featured image
- Uncaught TypeError: switchEditors.switchto is not a function
- Rest API and how to deal with it in server side
- Is it possible to override only a part of another plugin’s / theme’s js (asset) file?
- How do I integrate a codepen?
- add bootstrap modal after login in wordpress
- How to modify a class in load-scripts.js ?
- Remove Woocommerce product from cart with ajax/fetch