When I run a script in Wamp I get the following Warning Notifications for line 17 and 21. What is this telling me and what can/should be done to resolve the issue ?
Warning: Invalid argument supplied for foreach() in C:\wamp\www\eCardScript\ecard_lib.php on line 17 *Warning:* Invalid argument supplied for foreach() in C:\wamp\www\eCardScript\ecard_lib.php on line 21
<?php
include('htmlMimeMail.php');
function getPostGetVars() {
global $HTTP_POST_VARS,$HTTP_GET_VARS;
foreach ($HTTP_POST_VARS as $key => $value) { // This is Line 17
global $$key;
$$key = $value;
}
foreach ($HTTP_GET_VARS as $key => $value) { // This is Line 21
global $$key;
$$key = $value;
}
}
?>
Use $_GET
and $_POST
instead.
http://php.net/manual/en/language.variables.predefined.php
From PHP 5.0.3 long predefined arrays such HTTP_GET_VARS got disabled by default. For backward compatibility you can enable them in php.ini....