amin1982 Posted July 25, 2007 Share Posted July 25, 2007 Hey Guys, Some help needed please! I'm currently maintaining a website for a client however the site was written a while ago and is in PHP3 I believe. I have recently moved the site on my server which uses PHP 5. The site works ok however one feature on the site is having a back end which allows the user to login and add news, update, delete data... basically a custom content management system. The only problem however is when we click on submit to update a page or news item the page goes white and nothing is saved. The error logs show just one error which is: [Wed Jul 25 14:56:00 2007] [error] [client 81.201.136.69] PHP Warning: Invalid argument supplied for foreach() in /home/bbwebmaster/public_html/administer/list.php on line 248, referer: The code which this is talking about is: if ($addentry) $qry = "insert into ".$page." set "; $first = "yes"; foreach ($HTTP_POST_VARS as $postvar_key => //**LINE 248**// $postvar_value) { if (($postvar_key != 'Submit_x') && ($postvar_key != 'Submit_y')) { if ($first == "no") $qry .= ","; $qry .= $postvar_key."='".$postvar_value."'"; $first = "no"; } } I'm hoping that if I can fix this then the script will work... either that or downgrade my server to PHP3 OR 4 which I dont wish to do. If you can suggest anything please let me know. Thanks Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 25, 2007 Share Posted July 25, 2007 i assume it's because the $HTTP_POST_VARS variable isn't created anymore. replace it with $_POST (its replacement) and you should see the error disappear. keep in mind you'll need to do this site-wide, with all the superglobal arrays. Quote Link to comment Share on other sites More sharing options...
amin1982 Posted July 25, 2007 Author Share Posted July 25, 2007 Thanks! That seems to have solved the problem! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.