POST variable and PHP 7
| From: | Paul M Foster | Date: | Wed, 29 Apr 2020 20:13:17 +0000 |
| Subject: | POST variable and PHP 7 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-327116@lists.php.net to get a copy of this message | ||
Folks:
Consider a reentrant form. This is a form a user might be returned to if
they omit a field or enter some illegal value. It might look like this:
<input type="text" name="pizza" value="<?php echo
$_POST['pizza']; ?>" >
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?
Paul
--
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com