/    Sign up×
Community /Pin to ProfileBookmark

Submit button

I put two submit buttons on a form like so:

<input type=”hidden” name=”action” value=”option1″ />
<input type=”submit” value = “Option 1” />

<input type=”hidden” name=”action” value=”option2″ />
<input type=”submit” value = “Option 2” />

I want to do option 1 when I click the first submit button, but it always does Option 2. Are we only allowed one action/form or something?

Thanks

to post a comment
HTML

2 Comments(s)

Copy linkTweet thisAlerts:
@soccer362001Dec 06.2004 — I think your only allowed one action per form.
Copy linkTweet thisAlerts:
@ray326Dec 06.2004 — Yes. You either have to use multiple forms or Javascript buttons or you have to tie your processing to the value of the submit button. In the latter case you need to name all your submit buttons the same but give them distinct values.
×

Success!

Help @dennis99 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.22,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...