You are correct that under PHP5 no Notice was issued. While these messages will fill-up your apache error log, they are not an error per se. You need to check to see if the variable is set first: if (isset($_POST["pizza"])) { $glbPizza = $_POST["pizza"]; } -----Original Message----- From: Nick Kelley <nick@xxxxxxxxxxxxxxxxxxx> Sent: Wednesday, April 29, 2020 3:26 PM To: php-general@xxxxxxxxxxxxx Subject: Re: POST variable and PHP 7 CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you validate the sender and know the content is safe. On Wed, Apr 29, 2020 at 4:13 pm, Paul M Foster <paulf@xxxxxxxxxxxxxxxxx> wrote: > The first time through, under PHP 7, this will error out, because > there is no 'pizza' index for the $_POST array. The $_POST array is > empty. > > Seems like I used to use this exact idiom under PHP 5, and it worked, > but under PHP 7 it doesn't. > > Am I mis-remembering? If not, is there some common way around this > under PHP 7? > I can't speak to whether this would have worked in PHP 5 (I'm new enough to PHP that I started out on 7), but I think the fix you want is the new null coalescing operator ("??"), like this: <?php echo $_POST['pizza'] ?? ''; ?> See: https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.null-coalesce-op