Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What I would do is setup a simple page that echos Success or Fail, then pass the information to that page from the form using an Ajax call--You can use jQuery to accomplish this goal.</p> <p>Add this to the header in either a javascript file, or a script tag:</p> <pre><code>function submitEmail() { var email = $('#emailText').val(); jQuery.post('/submission.php', { email: email },function(data){ $('#submissionResponse').html(data); },html); } </code></pre> <p>Then alter the form so that the submission button is like so:</p> <pre><code>&lt;input type="button" name="submit" value="Submit" onclick="submitEmail();" /&gt; </code></pre> <p>Then add a div below the form with the id "submissionResponse" like so:</p> <pre><code>&lt;div id="submissionResponse"&gt;&lt;/div&gt; </code></pre> <p>This way you will be able to handle the post just like you do when you change pages, but you will automatically submit the data and grab the response.</p> <hr> <p>ANOTHER EDIT:</p> <p>While I'm at it, I might as well give another way to do similar. You could, instead of using Ajax, do exactly what you do now, but direct the form to reload the current page (<code>action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;"</code>) and then at the top of this page add</p> <pre><code>if(isset($_POST['email'])){ include('submission.php'); } </code></pre> <p>and underneath the form have:</p> <pre><code>&lt;div id="formStatus"&gt;&lt;?php echo isset($formStatusResponse) ? $formStatusResponse : null; ?&gt;&lt;/div&gt; </code></pre> <p>Two ways to accomplish the same goal. Using Ajax is faster, as it only requires the end user to load a single line of text, where as the second method requires the complete reloading of the entire page.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload