0

I have the following:

<?php

    $one = "hello";

    if(isset($_POST['one'])){
        $one = $_POST['one'];
    }

?>

The issue is I have a bunch of variables in the same format as this - is there a shorter way to default a variable to a value if the $_POST does not exist? Perhaps a one-liner?

Note, it does not matter if the $_POST['var'] variable is empty or not, just if it exists

jefiwo
  • 111
  • 1
  • 1
  • 6

0 Answers0