|
-
Feb 23rd, 2006, 03:04 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Use of undefined constant submit
Hello everybody,
I am getting following error.
Notice: Use of undefined constant submit - assumed 'submit' in E:\Projects\RxClub\rxclub\admin\admin_upload.php on line 18
Line 18 is
Code:
if ($_POST[submit]){
I am getting this error on almost all the pages and on different lines, however, I downloaded the site and its working fine online.
Any ideas ??
Thanks.
-
Feb 23rd, 2006, 04:50 AM
#2
Re: Use of undefined constant submit
submit needs to be enclosed in quote marks, as the error message says.
PHP Code:
if ($_POST['submit'])
-
Feb 23rd, 2006, 06:09 AM
#3
<?="Moderator"?>
Re: Use of undefined constant submit
You get this notice when you try and access something that has not been set yet, although PHP doesnt mind because it is dynamicly cast its looks neater and runns better if you check to see if the value is set before hand.
PHP Code:
if(isset($_POST['submit']))
{
if($_POST['submit'] == 'somevalue')
{
//do some stuff
}
}
[EDIT]
woops was thinking off "Notice: Undefined variable" penagates post will fix it though
Last edited by john tindell; Feb 23rd, 2006 at 06:16 AM.
-
Feb 23rd, 2006, 07:44 AM
#4
Re: Use of undefined constant submit
 Originally Posted by usamaalam
Hello everybody,
I am getting following error.
Notice: Use of undefined constant submit - assumed 'submit' in E:\Projects\RxClub\rxclub\admin\admin_upload.php on line 18
Line 18 is
Code:
if ($_POST[submit]){
I am getting this error on almost all the pages and on different lines, however, I downloaded the site and its working fine online.
Any ideas ??
Thanks.
Your website probably has display of notices disabled. As mentioned above, you should enclose textual array indexes in quotes.
I recommend you fix those things so you do not get any notices. Notices serve to warn you about use of undefined variables and use of undefined constants like you have seen above and when not ignored they can be used to indicate errors in your coding such as missspelt variable and constant names.
-
Feb 23rd, 2006, 08:54 AM
#5
Thread Starter
Frenzied Member
Re: Use of undefined constant submit
Is there a way to disable notice messages throughout the website. I have a large running website downloaded on my system and these messages are scattered on almost all the pages.
Thanks.
-
Feb 23rd, 2006, 09:35 AM
#6
Re: Use of undefined constant submit
You can disable them globally by modifying the error_reporting directive in the php.ini file.
-
Feb 23rd, 2006, 10:12 AM
#7
Thread Starter
Frenzied Member
Re: Use of undefined constant submit
How can I disable error_reporting directive in php.ini file. I am extremely new to PHP.
Thanks.
-
Feb 24th, 2006, 02:45 AM
#8
Thread Starter
Frenzied Member
Re: Use of undefined constant submit
I commented out the error_reporting = E_ALL; line and its working now.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|