I would like to know when it is really imperative to use isset
in PHP variables, especially in the case of forms.
What happens is that I'm creating a large form, with some 200+ fields, that will perform calculations and other functions in PHP according to the fill.
No field will be required, and the system will make the "calculation possible" with the information provided. For now, as I am just testing on localhost , it is not a problem to use the variables just like this:
$difsal = $_POST ["Tdifsalim"];
$saldev = $_POST ["Tdate5"];
So even if the respective field (% w / o% eg) is not filled in the form, script runs normal, and gives the expected result (according to the fields that were filled ). But then I wondered if afterwards, when I put it on the server, I still have to include all those Tdifsalim
to avoid request errors.
So the question is: does issets
in all form variables even necessary? If it is, in the example above the simplest way to include 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 ).