PHP script error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jayavidya
    New Member
    • Mar 2008
    • 5

    #1

    PHP script error

    Whenever I run the PHP script on the browser, a script error : "Object not found"
    is generated. The script I'm working on is syntactically correct.
    How can I detect this error in the code?
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    You've either mistyped the URL, havent saved the file in the folder you thought you had.. you might've saved the file with the wrong extension.

    This isn't a PHP 'syntax' error, it's a browser error.

    Regards.

    Comment

    • TheServant
      Recognized Expert Top Contributor
      • Feb 2008
      • 1168

      #3
      Originally posted by jayavidya
      Whenever I run the PHP script on the browser, a script error : "Object not found"
      is generated. The script I'm working on is syntactically correct.
      How can I detect this error in the code?
      Which browser? And can you post some of your code where it might be occuring? (USING CORRECT CODE TAGS)

      Comment

      • jayavidya
        New Member
        • Mar 2008
        • 5

        #4
        Originally posted by TheServant
        Which browser? And can you post some of your code where it might be occuring? (USING CORRECT CODE TAGS)
        Hi,
        The following is the IE7 browser error, after the form is submitted :

        Line: 45
        Char: 3
        Error: Object expected
        URL: http:// (on the local intranet)

        These are a few lines of code (lines 36-56) in the php script:
        [CODE=PHP]
        $value_business unit = "";
        if(isset($_POST['BusinessUnit']))
        $value_business unit = $_POST['BusinessUnit'];
        $value_sponsor = "";
        if(isset($_POST['Sponsor']))
        $value_sponsor = $_POST['Sponsor'];
        $value_proposal description = "";
        if(isset($_POST['ProposalDescri ption']))
        $value_proposal description = $_POST['ProposalDescri ption'];
        $value_projecti d = "";
        if(isset($_POST['ProjectId']))
        $value_projecti d = $_POST['ProjectId'];
        $value_closedon = "";
        if(isset($_POST['ClosedOn']))
        $value_closedon = $_POST['ClosedOn'];
        $value_serviced = "";
        if(isset($_POST['Serviced']))
        $value_serviced = $_POST['Serviced'];
        $value_entrydat e = "";
        if(isset($_POST['EntryDate']))
        $value_entrydat e = $_POST['EntryDate'];
        $value_entryby= "";
        if(isset($_POST['EntryBy']))
        $value_entryby = $_POST['EntryBy'];
        [/CODE]

        The above code is executed each time the form is refreshed.
        However, no errors are seen when the form is refreshed. The error arises only when the form is submitted.

        Comment

        • jayavidya
          New Member
          • Mar 2008
          • 5

          #5
          Originally posted by markusn00b
          You've either mistyped the URL, havent saved the file in the folder you thought you had.. you might've saved the file with the wrong extension.

          This isn't a PHP 'syntax' error, it's a browser error.

          Regards.
          Hi, thank you for letting me know the correct terminology. I'm still working on detecting the browser error. Even the URL is properly typed and the file is also saved in the required folder.

          The browser error is generated, everytime the form is submitted.

          Comment

          • Markus
            Recognized Expert Expert
            • Jun 2007
            • 6092

            #6
            Originally posted by jayavidya
            Hi, thank you for letting me know the correct terminology. I'm still working on detecting the browser error. Even the URL is properly typed and the file is also saved in the required folder.

            The browser error is generated, everytime the form is submitted.
            The problem may lay in the form.
            So can we see that?
            (correct code tags = code=html)

            Cheers.

            Comment

            • ronverdonk
              Recognized Expert Specialist
              • Jul 2006
              • 4259

              #7
              Are you using JavaScript either to check the validity of the submitted form fields, to handle a form event or to submit the form? Becaue this is not a PHP error: php does not run in the browser.

              Ronald

              Comment

              • jayavidya
                New Member
                • Mar 2008
                • 5

                #8
                Originally posted by ronverdonk
                Are you using JavaScript either to check the validity of the submitted form fields, to handle a form event or to submit the form? Becaue this is not a PHP error: php does not run in the browser.

                Ronald
                Hi,

                Thank you for guiding me on this concept. After reading your reply, I've just begun to understand that if there are any errors in PHP, the parse errors are generated and are displayed.

                After reviewing the code, I've been able to avoid the browser error. I'm using JavaScript to check the validity of date fields in the form.
                All the functions for checking the validity are defined in the file CheckDate.js
                I had used the script tags to include the functions in the current file as
                follows:
                [CODE=HTML]
                <script language="JavaS cript" src="CheckDate. js">
                </script>
                [/CODE]

                The path of the JS source file is also proper.
                But later I modified the code by copying all the functions' code from CheckDate.js to the current file and changed the enclosing script tags as follows:
                [CODE=HTML]
                <script language="JavaS cript" type="text/javascript">
                # All functions defined in CheckDate.js copied here
                </script>
                [/CODE]

                Both the methods are equivalent and should work fine. But the first method generated browser errors, while the second method worked fine.
                What could be the probable reason for this?

                Comment

                • arggg
                  New Member
                  • Mar 2008
                  • 91

                  #9
                  If you view the html source what is on line 45? It sounds like this is a javascript error.

                  Comment

                  Working...