This is pretty basic html really, NOT php.
A FORM has an action. That action is invoked by the clicking of a button of Type="submit". Therefore if you have a type=submit button with an onclick javascript event attached to it, you'll simply confuse your form.
<form action=test.php method=post>
<!-- Rest of form -->
<input type=submit value=SUBMIT>
</form>
Thats it. If you want your porm to have different possible outcomes, simply add another standard submit button to it with a new value eg <input type=submit value=SEARCH>
then just use the "switch()" I posted above (modify) to determine what to do according to which value $_POST['submit'] gets passed with.
If the "SUBMIT button is clicked the value of $_POST['submit'] will be "SUBMIT"
If the "SEARCH button is clicked the value of $_POST['submit'] will be "SEARCH"