The input value will be different from what is sent to POST

So the convention for using input of type submit is

<input type='submit' value='Submit'>

this will give me a button that says “send” on it, and inside the column array I will have

$_POST['submit'] = 'Submit'

Is it possible for the submit button to display "Submit", but has a post value of different. In other words, I want a button that still says send, but

$_POST['submit'] = 1

Is this possible without JavaScript?

+3
source share
3 answers

You can create a hidden input field with the name "submit" and set the value to 1. You do not need to set the value of the enter button itself to fix this value.

+3

. :

<INPUT> <BUTTON>. type=submit . <BUTTON> <BUTTON> </BUTTON>, value= .

, , Firefox.

+4

http://reference.sitepoint.com/html/input/type:

"" , value, , "".

, 1 , . -

<input type="submit" name="submit" value="Go!" onclick="this.value=1;"/>

.

, , , JS, Dylan answer

+1

Source: https://habr.com/ru/post/1757712/


All Articles