sungpeng Posted November 27, 2011 Share Posted November 27, 2011 http://localhost/link.php?course=fitness link.php <?php $course=$_GET[course]; echo "$course"; ?> I install the new apache it come out with this error "Use of undefined constant course - assumed 'course' in C:\xampp\htdocs\link.php on line 2". Previouly it is working fine on old one. Why it happened on new apache? Quote Link to comment https://forums.phpfreaks.com/topic/251891-install-new-apache-error-on-_get/ Share on other sites More sharing options...
kicken Posted November 27, 2011 Share Posted November 27, 2011 Previouly it is working fine on old one. Correction, it was just as broken on the old one. You just had your error reporting level set to not show notices. Array keys which are strings have to be quoted: $course=$_GET['course']; echo $course; Quote Link to comment https://forums.phpfreaks.com/topic/251891-install-new-apache-error-on-_get/#findComment-1291583 Share on other sites More sharing options...
sungpeng Posted November 27, 2011 Author Share Posted November 27, 2011 Array keys which are strings have to be quoted:? how to make it correct? "Use of undefined constant course - assumed 'course' in C:\xampp\htdocs\link.php on line 2" refer to "$course=$_GET['course'];" Quote Link to comment https://forums.phpfreaks.com/topic/251891-install-new-apache-error-on-_get/#findComment-1291586 Share on other sites More sharing options...
sungpeng Posted November 27, 2011 Author Share Posted November 27, 2011 solved ["course"] Quote Link to comment https://forums.phpfreaks.com/topic/251891-install-new-apache-error-on-_get/#findComment-1291590 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.