0

Im trying to created a button with the text "Delete" write on them. when this button is clicked it will export some values with the method GET. but because of this the "value" of the button displays the values that will be exported instead the word "Delete how can i change this?

<form action="usuario.php" method="get">
  <input type="submit" name="mesa" class="success button" value="<?php echo 
  $row['mesa'];?>"/>
</form>
1
  • @FabianGillenius — That's less manageable. It means using two elements instead of one, and doesn't let you identify which of a set of buttons was clicked. Commented Feb 21, 2019 at 13:53

2 Answers 2

3

Use a button element instead of an input element.

<button name="name" value="value submitted when clicked">Display Text</button>
Sign up to request clarification or add additional context in comments.

4 Comments

Then you need to add "type=submit" else the button won't submit the form
@PHPnoob — Incorrect. submit is the default value for the type attribute on button elements.
"Tip: Always specify the type attribute for a <button> element. Different browsers use different default types for the <button> element." From w3schools.com/tags/tag_button.asp
@PHPnoob — Pretty sure the bug that terrible website refers to was fixed when IE7 came out. Might have been earlier. Don't trust W3Schools.
-1

Use another input with hidden attribute to send your values :

<input type="hidden" name="mesa" value="<?php echo $row['mesa'];?>">

And set submit button's value to the label you want for it :

<input type="submit" name="submit_button" class="success button" value="Delete">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.