[Quick Reminder]Multiple submit buttons in the same HTML form

The trick us, use the same name but different values on the button.
For example, if we wanted to have both ‘Submit’ and ‘Cancel’ in the same form.

<form action=’blah.foo’ method=’post‘>
<input type=’text‘ name=’blah‘ />
<button name=’actionvalue=’submit‘>Submit</button>
<button name=’actionvalue=’cancel‘>Remove</button>

So now, in whatever language we use to treat the post request, we could simply read the posted data from these buttons

For example, in PHP

$action = $_POST[‘action’];

if ($action == ‘submit’)


else if ($action == ‘cancel’)


or in ASP.net
string action = Request.Form[“action”];
switch (action)
case “submit”:
case “cancel”:
case “default”:

That’s why I need to start this blog…..I forgot how to get POST from ASP.net now. Something like Request.QueryString….?

People are doing more complex things now it’s taking on average more clicks to find these fundamental references


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s