I do not want this piece of code running when the page actions to itself.\[code\] //There was an identical id and request is somewhat real. (Still possible of a lucky guess) if($array['isbeingwritten'] == 1) { //The article is already being written. echo '<script type="text/javascript">alert("That article is being written. Someone beat you to it. You will now be redirected.");</script>'; echo '<script type="text/javascript">window.location.href="http://stackoverflow.com/questions/12757358/write.php";</script>'; }\[/code\]So I've done this:\[code\]if(!isset($_POST['submit'])){ //There was an identical id and request is somewhat real. (Still possible of a lucky guess) if($array['isbeingwritten'] == 1) { //The article is already being written. echo '<script type="text/javascript">alert("That article is being written. Someone beat you to it. You will now be redirected.");</script>'; echo '<script type="text/javascript">window.location.href="http://stackoverflow.com/questions/12757358/write.php";</script>'; }}\[/code\]That doesn't work. It still runs that code after pressing submit!! Here is my form:\[code\] <form method="post" id="writearticle" action=""> <textarea rows="30" cols="85" id="articlecontent" name="content" placeholder="Write the article here. Try to abide by the instructions and keywords provided." onkeyup="checkWordCount();" ></textarea> <br /> <input type="submit" id="submit" name="submitarticle" value="http://stackoverflow.com/questions/12757358/Submit Article" class="submit" disabled /> <br /><br /><br /><br /><br /> </form>\[/code\]