Send the form to submit



  • введите сюда описание изображения

    How are you in this situation? There are three buttons to submit. How to trace separately when compressed delete when move, etc. At this point, if I'm hitting something on the POST search and press, all three buttons are coming up.



  • Give all the buttons the same name.namebut different valuesvalue) The server will be given the value associated with a pressed button.

    Example:

    1. HTML (client side):

      <input type="submit" name="action" value="Move To" />
      <input type="submit" name="action" value="Delete" />
      
    2. PHP (sternity):

      if ($_POST['action'] == 'Move To')
      {
          // ...
      }
      else if ($_POST['action'] == 'Delete')
      {
          // ...
      }
      else
      {
          // Защита от (вероятно злонамеренно) некорректного значения
      }
      



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2