8
I would like to know when it really is essential to use the isset
variables in PHP, especially in the case of forms.
What happens is that I am creating a large form, with some 200+ fields, which will perform calculations and other functions in PHP according to the fill out.
No field will be mandatory, and the system will make the "possible calculation" with the information provided. For now, how am I testing just on localhost, no problem using variables just like this for example:
$difsal = $_POST ["Tdifsalim"];
$saldev = $_POST ["Tdate5"];
So even if the respective field (Tdifsalim
for example) is not completed on the form, the script normal wheel, and gives the expected result (according to the fields that have been filled). But then I was in doubt if later, when to put in the server, I still have to include all these issets
to avoid request errors.
So the question is: ask isset
in all form variables is it really necessary? If it is, in the example above what is the simplest way to include the isset
so that when the field is not filled in, the value of the variable is equal to null (not 0, because it can affect the calculations).
Thanks, that’s exactly what I wanted to know!
– gustavox