deft Posted October 16, 2007 Share Posted October 16, 2007 I moved to a new laptop and after installing apache/php/mysql on it successfully, I copy my php files and database over, but my XP SP2 install of Apache 2.2.6, PHP 5.2.4 and MySQL 5.0.4 is having trouble with POST data. I get 'Undefined index' or 'Undefined constant' errors everywhere a value is sent with POST through a form. Quote Link to comment Share on other sites More sharing options...
trq Posted October 16, 2007 Share Posted October 16, 2007 This is generally caused by poor programming. They are 'Notices' and as such can be switched off by the right error reporting level in your php.ini. Bets to fix the code though. 1. Are you checking the indexes are set before trying to use them? 2. Make sure your indexes are surrounded by quotes, array keys are strings. eg; <?php // good. if (isset(_POST['var'])) { $var = $_POST['var']; } // instead of (bad). $var = $_POST[var]; ?> Quote Link to comment Share on other sites More sharing options...
deft Posted October 17, 2007 Author Share Posted October 17, 2007 Right, ok, now I see those message titled 'Notice' aren't to do with anything stopping the code from working. They must be less serious than 'warnings'. (?) Is there a setting in php.ini to turn them off? Quote Link to comment Share on other sites More sharing options...
trq Posted October 17, 2007 Share Posted October 17, 2007 Yes, should have been a little clearer with my hints, have a look at the error_reporting directive within your php.ini. Still though, IMO your best off to keep the error reporting where it is, fix your existing code and get in the habbit of creating well formed code in the first place. Quote Link to comment Share on other sites More sharing options...
deft Posted October 17, 2007 Author Share Posted October 17, 2007 yeah true that, but I gotta get this thing working (meaning presentable to customers seeing it). I'll turn it back up and work out the errors as I go. good advice, mr. thorpe, thnx 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.