After submitting an HTML form, I noticed that SOME empty input fields get sent to the $_POST array while others don't (they all have a name attribute). What determines what gets set and what does not?
<!DOCTYPE html>
<head><title>EXAMPLE TEST</title></head>
<body>
<form action="/test.php" method="post">
<input type="text" name="text">
<input type="radio" name="radio">
<input type="checkbox" name="checkbox">
<input type="date" name="date">
<textarea name="textarea" rows="5"></textarea>
<input type="submit" name="submit">
<!-- etc... -->
</form>
<?php var_dump($_POST); ?>
</body>
</html>
Leaving all fields untouched and submitting the form, var_dump($_POST) shows:
array(3) { ["text"]=> string(0) "" ["textarea"]=> string(0) "" ["submit"]=> string(6) "Submit" }
I'm asking this because my script "was" seemingly adding the empty radio to $_POST["radio"] and my script was working fine, but now suddenly it doesn't appear in the array. I haven't modified anything in my script. But my question isn't about my script, my question is: how do I know which empty fields get set in the $_POST array, and is this always guaranteed?