Php: read attribute from form element

Can I read an attribute from a form element?

I got it:

<input class="number required" min="1250" max="999999999" id="insert_counter1" name="my_counter" value="" type="text">

After submitting, I can access the value. But is there a way to get other attributes like min or max?

Right now I have a hidden read-only input field named my_counter_min, where the attribute "min" is stored. I don't know if this work works or not, this is the only way to do it.

Br. Anders

UPDATED based on the answers below:

Thanks for the good feedback. When I read the answers, there are three good solutions with some pros and cons.

  • Save value in input type = hidden. Easy to do, but fake
  • Use a parser. It takes more time for the code, but the original value will be obtained through a new web request. So no fakes
  • . rcord , , allready ( ).

. , , .

BR.

+3
4

, , .

. .

+3

. , (, , ).

+4

, HTML .

: ? min/max, , , , .

, . , , .

+3

. , , . .

One thing I can think of is storing values ​​in a database so you can: 1. Use them as an input variable. 2. Get access to it at any time.

Ps: This was originally a comment, but seeing that you accept alternatives.

+2
source

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


All Articles