如何通过Select onChange与Submit Button提交表单

I need assistance determining when my form was submitted via an onChange event for a Select as opposed to the user clicking on the Submit button.

To complicate matters, I need to be able to identify the difference in PHP.

Sample HTML:

<form name='editdata' method='post' action='/editpage/recordnumber'>
<select name='select1' onchange='this.form.submit()'><options...></select> 
<select name='select2' onchange='this.form.submit()'><options...></select>
<select name='select3' onchange='this.form.submit()'><options...></select> 
<input type='submit' value='Submit' />
</form>

Ultimately, I just need something to latch onto using PHP that identifies whether the form was submitted by an onChange event or by a press of the Submit button.

So far I have found that I can name my submit button 'submit'. This will set $_POST['submit'], thereby telling me that the user clicked the button. However, my onChange event this.form.submit() which is applied to a couple of my Selects stops functioning when I add the name attribute to my submit button.

If I could add some sort of queryString to the end of my submit URL with one method or the other, I think that would get the job done.

You could set a hidden field which gets updated by the event:

<form name='editdata' method='post' action='/editpage/recordnumber'>
<input type="hidden" name="submitted_on_change" value="0">
<select name='select1' onchange='form_submit()'><options...></select> 
<select name='select2' onchange='form_submit()'><options...></select>
<select name='select3' onchange='form_submit()'><options...></select> 
<input type='submit' value='Submit' />
</form>

<script>
var form_submit = function() {
   // update the hidden field to 1
   // then submit the form
}
</script>

You can call multiple functions inside your onchange and fill another field with the name of the select field that caused the submission of the form (or it is empty when submit button was pressed):

<form name='editdata' method='post' action='/editpage/recordnumber'>
<input type='hidden' name='field' value='' />
<select name='select1' onchange='this.form.field.value=this.name; this.form.submit();'><options...></select> 
<select name='select2' onchange='this.form.field.value=this.name; this.form.submit();'><options...></select>
<select name='select3' onchange='this.form.field.value=this.name; this.form.submit();'><options...></select> 
<input type='submit' value='Submit' />
</form>