215 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 1 and 9 users
  • Sold between 100 and 1 000 dollars
  • United Kingdom
NuclearThemes says

I’m having a bit of a mental block at the moment. I have two buttons in a WP plugin that need to run separate functions. I can only think of one way to do it but it doesn’t sound like the best solution.

Encase each button in a form with a hidden field. Is there a better way?

3365 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred more than 2000 users
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+4 more
sevenspark Volunteer moderator says

Or you can place two submit buttons in the same form, give them different names, and test for which name was submitted on the back end. Only the input button that was clicked will be submitted in the form data. :)

215 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 1 and 9 users
  • Sold between 100 and 1 000 dollars
  • United Kingdom
NuclearThemes says

Precisely what was needed, thanks :)

3365 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred more than 2000 users
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+4 more
sevenspark Volunteer moderator says

You’re welcome :)

by
by
by
by
by
by