Submit to same page

Simply remove the action=”” parameter and a form will be submitted to the same page. Any URL arguments will also be retained.

  <form method="POST">

If you want to submit to the same page but with any previous URL arguments removed:

<form action="?" method="POST">

A longer explicit way of submitting to the same page

<?php
  $FormSubmitUrl = $_SERVER['REQUEST_URI'];
?>

  <form action="$FormSubmitUrl" method="POST">

  </form>

Auto Submit

Auto submit when selecting an item in a select box

  <select name="my_playlists" onchange="this.form.submit()">

  </select>
Auto submit form when file selected
<input type="file" name="image_file" multiple="false" onchange="my_form_id.submit();" ">
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *