...

View Full Version : Determining how a form was submitted



astrobob
07-06-2005, 03:51 PM
Hi,

I'm using the onchange attribute of the select tag to display info dynamically depending on the value of another drop down list.
In order to do that, I submit the form when the value is changed, so that I can keep all the other values of the form.

However, I'd like to process the data only if the user clicked the "Submit" button, not if the form was submitted by changing the value of one of the drop down lists.

Any idea how I can know when the submit button has been clicked ?

Beeper
07-06-2005, 04:30 PM
I would need to see code to help you

NancyJ
07-06-2005, 04:41 PM
you need to add a check to the value of the submit button (obviously the syntax depends on the language you're using)
ie
php


if(isset($_POST['submit']){
//process the form
}


asp:


if request.form('submit')<> "" then
'process form

astrobob
07-06-2005, 04:45 PM
'submit' being the name of the button, I understand ?
I was thinking of this solution, but wasn't sure if the button was considered "set" only if clicked.

NancyJ
07-06-2005, 04:49 PM
yes replace 'submit' with the name of your submit button



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum