two buttons on html page flask
<input type="submit" name="submit_button" value="Do Something">
<input type="submit" name="submit_button" value="Do Something Else">
def contact():
if request.method == 'POST':
if request.form['submit_button'] == 'Do Something':
pass # do something
elif request.form['submit_button'] == 'Do Something Else':
pass # do something else
else:
pass # unknown
elif request.method == 'GET':
return render_template('contact.html', form=form)<form method ="post" action="/">
<button type="submit" name="submit_a" value="submit_a"> Submit_a </button>
<button type="submit" name="submit_b" value="submit_b"> Submit_b </button>
</form>
def submit():
if request.method == "POST":
if request.form.get("submit_a"):
# do something
elif request.form.get("submit_b"):
# do something else
elif request.method == "GET":
# do something
Also in HTML:
- & in html
- html embed a pdf
- html hyperlink with question mark in a form action
- how to align text beside image in html
- how to include a dash in html
- stylesheet einbinden html5
- .innerhtml
- html iframe no border
- html legend fieldset
- form action html
- slide show in html
- excel vba tool to help with refactoring code
- ASP.NET MVC Two file upload, different destinations
- html redirecting to previous page
- html boilerplate vscode
- html placeholder multiple lines
- volume in html
- create page html
- execute js from image
- vue conditional class
- html specific class color
- bulma react example upload file progress bar
- javascript onclick alert are you sure
- how to add multiple videos in html5 with javascript