I have some simple code what gets user inserted parameters. But how can I use $_POST
to set a default value? For example, if a user is asked to input name and age and he chose to input only the name I need that $_POST
sets age to 0.
My code what I use:
$name = $_POST['name'];
$weight= $_POST['weight'];
$size = $_POST['size'];
And sometimes there can be only weight or size so I need to set up default value. I tried $size = $_POST['size'] ?? 0;
but it not worked.
??
worked in php 7+