At the moment, I have a form with an input (text) and a button to submit the form.
The form is posted to 'submit.php'. I would like the form posted to same page as the form.
How can I do this?
<form action="submit.php" method="POST"> <input type="text" class="emailField" placeholder="email address" name="email" /> <button type="submit"> <div class="submit" /> </button> </form> submit.php
<?php mysql_connect('localhost', '', '') or die('unable to connect'); mysql_select_db('') or die('unable to select db'); $query = mysql_query(""); if (mysql_num_rows($query) > 0) { exit("You have already subscribed!"); } else { mysql_query("") or die(mysql_error()); exit("You have successfully subscribed!"); } ?>
exit()method? Is your question missing some code?