By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,460 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

Form Question

P: n/a
I have a form being filled in dynamically using PHP. It's working except
I've run into an issue with the submit. I have a Select component (drop down
box) that has an onchange="this.form.submit()" so that users can simply pick
the item to be edited. Furtner down there's a standard submit button... How
can I differentiate between the two submits?
If they pick an item from the dropdown I just want to fill in the form with
the data selected from the database for that record. If they hit the submit
button, I want to post the form and save that data into the database.
Seems like it should be an easy one, but I'm just missing it.

Dave -
Adobe Community Expert
May 22 '06 #1
Share this Question
Share on Google+
2 Replies

P: n/a

Dave Mennenoh wrote:
How can I differentiate between the two submits?

<input type="submit" name="foo" value="bar">
Clicking this button will post the form like there was a input field
with name foo and value bar. Look for $_POST['foo']. If it exists, the
button is clicked.
Another option is to use javascript to fill a hidden field. Something
like this:
<input type="hidden" name="TypeOfSubmit" id="TypeOfSubmit">
<input type="submit"
onClick="getElementById('TypeOfSubmit').value='1'" >
<input type="submit"
onClick="getElementById('TypeOfSubmit').value='0'" >

May 22 '06 #2

P: n/a
>><input type="submit" name="foo" value="bar">

Thanks! I knew it was a simple one.

Dave -
Adobe Community Expert
May 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.