Note that there are some explanatory texts on larger screens.

plurals
  1. PODisable submit form after actions are complete
    text
    copied!<p>Ok, I've been going nuts for hours trying to figure this out...</p> <p>I want my form to be disabled after clicking it so multiple submissions don't occur. But when ever I try methods to disable it.. And I have tried MANY ways, It will disable the button after clicking it but it stops all the functions that form was supposed to do. for instance adding this to my code disables the form after clicking it but stops all functions.</p> <pre><code>onclick="this.disabled=true;this.value='Sending, please wait...';this.form.submit();" </code></pre> <p>Here is my form</p> <pre><code>&lt;form name="input" action="" method="post" id="id"&gt; &lt;div align="center"&gt; &lt;input name="Submit" id="Submit" type="submit" class="button" value="Explore Map!"/&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>Here is what is supposed to happen when the form is clicked ( I know the code is horrible and unsafe but it works and thats pretty much what I need.)</p> <pre><code>if (isset($_POST['Submit'])) { include 'includes/mapstuff.php'; // Ok so we called the submit button sbubmit and the method is post so // So here we pick a random row from the table pokemon notice the order by rand $sql23 = "SELECT * FROM map1pokemon ORDER BY RAND() LIMIT 1;"; // We then check for errors $result23 = mysql_query($sql23) or die(mysql_error()); // we then make the result into a virable called battle_get23 $battle_get23 = mysql_fetch_array($result23); $sql2 = "SELECT * FROM pokemon WHERE name='".$battle_get23['pokemon']."'"; $result2 = mysql_query($sql2) or die(mysql_error()); $battle_get2 = mysql_fetch_array($result2); // Now we need to make sure the image is safe be for we use it $pic2= mysql_real_escape_string($battle_get2['pic']); $pic = strip_tags($pic2); include 'includes/maptypes.php'; ?&gt; &lt;form name="inputt" action="" method="post"&gt; &lt;div align="center"&gt; &lt;input type="submit" class="catch" value="Catch Pokemon" name="catch"&gt; &lt;/div&gt; &lt;/form&gt; &lt;p&gt;&lt;/p&gt; &lt;?php echo "You have just found a " ; echo $randomview[0]; echo " "; // we can now print off any column we want about the random pokemon e.g the name the pic etc... here I chose to print out the name.but th echo $battle_get23['pokemon']; $_SESSION['pokemon'] = $battle_get23['pokemon']; $_SESSION['type'] = $randomview[0]; $_SESSION['pic'] = $battle_get2; $_SESSION['money'] = $randomview2[0]; $_SESSION['level'] = $randomview3[0]; $_SESSION['ticket'] = $randomview4; ?&gt; &lt;p&gt;&lt;/p&gt; &lt;?php echo "You have gained ".$randomview3[0]." levels" ; echo " "; ?&gt; &lt;p&gt;&lt;/p&gt; &lt;?php echo "You have received $".$randomview2[0]."" ; echo " "; ?&gt; &lt;p&gt;&lt;/p&gt; &lt;?php echo "&lt;/center&gt;"; } ?&gt; </code></pre>
 

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