Results 1 to 8 of 8

Thread: [RESOLVED] Use of undefined constant submit

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Resolved [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.

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Use of undefined constant submit

    submit needs to be enclosed in quote marks, as the error message says.

    PHP Code:
    if ($_POST['submit']) 

  3. #3
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    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.

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Use of undefined constant submit

    Quote 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.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    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.

  6. #6
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Use of undefined constant submit

    You can disable them globally by modifying the error_reporting directive in the php.ini file.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  7. #7

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Re: Use of undefined constant submit

    How can I disable error_reporting directive in php.ini file. I am extremely new to PHP.

    Thanks.

  8. #8

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    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
  •  



Click Here to Expand Forum to Full Width