0
I wonder if it is possible for me to define a default value that would be number 0 without this 0 being shown to the user, this value is necessary because I am taking these numbers typed and processing in PHP, I store in a variable, and multiply the values, when I leave one of these empty inputs PHP displays an error that says the value is not a precise number that this number 0 is hidden to the user and works under the screens
<html>
<head></head>
<body>
<input type="number" value="0">
</body>
</html>
creates an attribute for this:
<input type="number" default-value="0">
but remember nothing in hmtl gets even no access to the user, just view the page code– Ricardo Pontual
Now it gave error in my PHP, the error says it is a value non-numeric value encountered, a value not numerical I used it for sum so it shows this error, the situation is simple but there is something behind, IF I do not leave the input empty using the number 0 as value it does not generate number error, if I use this attribute it generates this error
– Daniel Elias
An answer using JS would help you?
– hugocsl
yes, it can even be in css if you have
– Daniel Elias
What do you mean when you quote that this value is not sample to the user?
– Augusto Vasques
You know that 0? that appears in the place of input? the user will have to delete it manually, or if he does not pay attention will write for example: "0100, 0200" why 0 ta there, nothing else just want that 0 is available for PHP not to give error, would like (if there is) a solution like the google search bar that when clicking can overwrite and so on, or you would know a solution for PHP if the input does not contain any numbers received it uses the 0 in the variable? main is not html the problem is how PHP will process...
– Daniel Elias
@Danielelias, because you leave the value with nothing and when you pass it to PHP it eliminates these inputs with value 0 or simply adds the 0 to the empty inputs?
– Jakson Fischer
This type of checking should be done on the server, with PHP. Anything you do, whether with HTML or JS, will be gambiarra and have side effects. Just don’t set the attribute
value
field and in PHP make the condition if empty, assign 0.– Woss