How to open a new window on form submit

No need for Javascript, you just have to add a target=”_blank” attribute in your form tag. <form target=”_blank” action=”http://example.com” method=”post” id=”mc-embedded-subscribe-form” name=”mc-embedded-subscribe-form” class=”validate” >

JavaScript Form Submit – Confirm or Cancel Submission Dialog Box

A simple inline JavaScript confirm would suffice: <form onsubmit=”return confirm(‘Do you really want to submit the form?’);”> No need for an external function unless you are doing validation, which you can do something like this: <script> function validate(form) { // validation code here … if(!valid) { alert(‘Please correct the errors in the form!’); return false; … Read more

Submitting a form by pressing enter without a submit button

Update 2022: Use this instead <input type=”submit” hidden /> Notice – Outdated answer Please do not use position: absolute in the year 2021+. It’s recommended to use the hidden attribute instead. Otherwise, look down below and pick a better, more modern, answer. Try: <input type=”submit” style=”position: absolute; left: -9999px”/> That will push the button waaay … Read more

Two submit buttons in one form

Solution 1: Give each input a different value and keep the same name: <input type=”submit” name=”action” value=”Update” /> <input type=”submit” name=”action” value=”Delete” /> Then in the code check to see which was triggered: if ($_POST[‘action’] == ‘Update’) { //action for update here } else if ($_POST[‘action’] == ‘Delete’) { //action for delete } else { … Read more

jQuery AJAX submit form

This is a simple reference: // this is the id of the form $(“#idForm”).submit(function(e) { e.preventDefault(); // avoid to execute the actual submit of the form. var form = $(this); var actionUrl = form.attr(‘action’); $.ajax({ type: “POST”, url: actionUrl, data: form.serialize(), // serializes the form’s elements. success: function(data) { alert(data); // show response from the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)