<input type="submit" value="SEND" name="btnSubmit" />

Styling

See here

Using An Image For The Button

	<input type="image" src="images/my_button.png" alt="Call" name="submit" />

Multiple Submit Buttons

Using the button name parameter
if (isset($_POST['MyButton1']) && ($_POST['MyButton1'] != Null))
{
}
if (isset($_POST['MyButton2']) && ($_POST['MyButton2'] != Null))
{
}
  <form id="MyForm" action="http://www.mydomain.com/some_file.php" method="POST">
    <input type="submit" name="MyButton1" value="Save Message" />      
    <input type="submit" name="MyButton2" value="DISPLAY IT" />
  </form>
Using the buttons “value”
<?php
if ((isset($_POST['submit_button_action'])) && ($_POST['submit_button_action'] == 'Save Message'))
{
	//----- FORM SAVE MESSAGE -----
	echo "Save <br />";
}
else if ((isset($_POST['submit_button_action'])) && ($_POST['submit_button_action'] == 'DISPLAY IT'))
{
	//----- FORM DISPLAY MESSAGE -----
	echo "Display <br />";
}
?>
  <form id="MyForm" action="http://www.mydomain.com/some_file.php" method="POST">
    <input type="submit" value="Save Message" name="submit_button_action" />      
    <input type="submit" value="DISPLAY IT" name="submit_button_action" />
  </form>

Different Value and Button Text

  <button type="submit" name="MyName" value="MyValue">My Button Text</button>

Cancel button

You have to create on, there’s no standard cancel button

In the form:

    <input type="submit" value="Cancel" name="submit_button_action" />
    <input type="submit" value="Save" name="submit_button_action" />
  </form>

When handling the form:

  if ((isset($_POST['submit_button_action'])) && ($_POST['submit_button_action'] != 'Cancel'))
  {
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *