adwaitk007 Posted May 13, 2011 Share Posted May 13, 2011 Hello, I am newbie to this forum and also not a professional coder. Only have little bit of knowledge but not an expert. So I am in need of your help. I am having a mp3 search engine script installed here: www.listenmymp3.com The problem: whenever anyone tries to register the system shows "Registration failed" error! If he refresh the page then automatically registration form comeup! then if anyone fills the form and press "join now" it gives some forehech() error! Detailed error: it says: Warning: Invalid argument supplied for foreach() in /.............../register.php on line 187 Warning: Invalid argument supplied for foreach() in /.............../register.php on line 229 From line 183 to 194 the code is: <? if($form->num_errors > 0){ // echo " <font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font> "; $i=0; foreach($form->errors as $cur){ if($cur==""){}else{$i++; echo"";} } } unset($HTTP_SESSION_VARS['regsuccess']); ?> And from line 225 to 234 the code is: <? if($form->num_errors > 0){ $i=0; foreach($form->errors as $cur){ if($cur==""){}else{$i++; echo"<font size=\"2\" color=\"#ff0000\">".$cur."</font><br> ";} } echo "<br> <font size=\"2\" color=\"#ff0000\">".$i." error(s) found</font></center> "; //print_r($form->errors[$field]); } ?> So can anyone tell me what's wrong with it?? Any solution to this problem?? Quote Link to comment https://forums.phpfreaks.com/topic/236286-getting-error-warning-invalid-argument-supplied-for-foreach/ Share on other sites More sharing options...
gizmola Posted May 13, 2011 Share Posted May 13, 2011 That is a warning, which is not an error. If this is a production server you should not be displaying errors but rather logging them to a file. Bottom line, that script is really old and employs poor coding techniques and antiquated PHP. I would suggest finding a better one. Quote Link to comment https://forums.phpfreaks.com/topic/236286-getting-error-warning-invalid-argument-supplied-for-foreach/#findComment-1214851 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.