problem with $_SERVER['REQUEST_METHOD'] == 'POST'

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rynato@gmail.com

    #1

    problem with $_SERVER['REQUEST_METHOD'] == 'POST'

    whatever code I put inside this IF statement:

    if ($_SERVER['REQUEST_METHOD '] == 'POST')

    I get a parse error. Even 'print "something goes here"' doesn't work.
    Any ideas?

  • Schraalhans Keukenmeester

    #2
    Re: problem with $_SERVER['REQUEST_METHOD '] == 'POST'

    rynato@gmail.co m wrote:
    whatever code I put inside this IF statement:
    >
    if ($_SERVER['REQUEST_METHOD '] == 'POST')
    >
    I get a parse error. Even 'print "something goes here"' doesn't work.
    Any ideas?
    >
    If you get a parse error you probably have a syntactic error earlier in
    the code you have this line in. What do you mean exatly by: "whatever I
    put inside this IF statement?" Something like this?

    if ($var=='somestr ing') {
    do_something_or _other(); // <== you mean this bit?
    }

    Please post a larger chunk of the code the statement is part of, then
    maybe there's something we can help you with. Like it is the statement
    should be ok, assuming it is followed by at least a (empty or
    meaningful) statement.
    In other words: if (true); is correct, without the ; it's an error.

    Comment

    • rynato@gmail.com

      #3
      Re: problem with $_SERVER['REQUEST_METHOD '] == 'POST'

      the problem is fixed. The weird part is, I had to manually re-key a
      few of the lines of code. Every time I re-keyed a line, char for char,
      the error shifted down one line. Finally I had re-keyed enough of the
      lines of code and it worked - to a point.

      Now the problem is this:

      the script runs fine. It's to upload an image and then resize it.

      I have this line of code:

      print "<form action=\"<?php print (\$_SERVER['PHP_SELF']); ?>\" method=
      \"post\" enctype=\"multi part/form-data\">\n";

      when I browse locally to a photo, select it for upload, then submit
      it, I get a 404 error with the following path (I chopped off the
      unimportant first half of the URL):

      /siteAdministrat ion/%3C?php%20print %20($_SERVER['PHP_SELF']);%20?%3E

      so it looks to me like it's not parsing the action command
      correctly??? I have spent hours on this trying to find the problem and
      I cannot see any syntax errors here. Any suggestions out there?

      Comment

      • Schraalhans Keukenmeester

        #4
        Re: problem with $_SERVER['REQUEST_METHOD '] == 'POST'

        rynato@gmail.co m wrote:
        the problem is fixed. The weird part is, I had to manually re-key a
        few of the lines of code. Every time I re-keyed a line, char for char,
        the error shifted down one line. Finally I had re-keyed enough of the
        lines of code and it worked - to a point.
        >
        Now the problem is this:
        >
        the script runs fine. It's to upload an image and then resize it.
        >
        I have this line of code:
        >
        print "<form action=\"<?php print (\$_SERVER['PHP_SELF']); ?>\" method=
        \"post\" enctype=\"multi part/form-data\">\n";
        >
        when I browse locally to a photo, select it for upload, then submit
        it, I get a 404 error with the following path (I chopped off the
        unimportant first half of the URL):
        >
        /siteAdministrat ion/%3C?php%20print %20($_SERVER['PHP_SELF']);%20?%3E
        >
        so it looks to me like it's not parsing the action command
        correctly??? I have spent hours on this trying to find the problem and
        I cannot see any syntax errors here. Any suggestions out there?
        >
        Your code is wrong. You start with some php code and then introduce new
        php opening tags again. That would only make sense when it's part of an
        otherwise pure html line.

        You probably nee something like this instead:

        print "<form action='$_SERVE R['PHP_SELF']' method='POST
        enctype='multip art/form-data'>";


        Comment

        • Schraalhans Keukenmeester

          #5
          Re: problem with $_SERVER['REQUEST_METHOD '] == 'POST'

          Schraalhans Keukenmeester wrote:
          rynato@gmail.co m wrote:
          >the problem is fixed. The weird part is, I had to manually re-key a
          >few of the lines of code. Every time I re-keyed a line, char for char,
          >the error shifted down one line. Finally I had re-keyed enough of the
          >lines of code and it worked - to a point.
          >>
          >Now the problem is this:
          >>
          >the script runs fine. It's to upload an image and then resize it.
          >>
          >I have this line of code:
          >>
          >print "<form action=\"<?php print (\$_SERVER['PHP_SELF']); ?>\" method=
          >\"post\" enctype=\"multi part/form-data\">\n";
          >>
          >when I browse locally to a photo, select it for upload, then submit
          >it, I get a 404 error with the following path (I chopped off the
          >unimportant first half of the URL):
          >>
          >/siteAdministrat ion/%3C?php%20print %20($_SERVER['PHP_SELF']);%20?%3E
          >>
          >so it looks to me like it's not parsing the action command
          >correctly??? I have spent hours on this trying to find the problem and
          >I cannot see any syntax errors here. Any suggestions out there?
          >>
          Your code is wrong. You start with some php code and then introduce new
          php opening tags again. That would only make sense when it's part of an
          otherwise pure html line.
          >
          You probably nee something like this instead:
          >
          print "<form action='$_SERVE R['PHP_SELF']' method='POST
          enctype='multip art/form-data'>";
          >
          >
          add another single quote after POST. My bad.

          Comment

          • Rami Elomaa

            #6
            Re: problem with $_SERVER['REQUEST_METHOD '] == 'POST'

            rynato@gmail.co m kirjoitti:
            the problem is fixed. The weird part is, I had to manually re-key a
            few of the lines of code. Every time I re-keyed a line, char for char,
            the error shifted down one line. Finally I had re-keyed enough of the
            lines of code and it worked - to a point.
            >
            Now the problem is this:
            >
            the script runs fine. It's to upload an image and then resize it.
            >
            I have this line of code:
            >
            print "<form action=\"<?php print (\$_SERVER['PHP_SELF']); ?>\" method=
            \"post\" enctype=\"multi part/form-data\">\n";
            Change this to
            print "<form action='" . $_SERVER['PHP_SELF'] . "' method='post'
            enctype='multip art/form-data'>\n";
            >
            when I browse locally to a photo, select it for upload, then submit
            it, I get a 404 error with the following path (I chopped off the
            unimportant first half of the URL):
            >
            /siteAdministrat ion/%3C?php%20print %20($_SERVER['PHP_SELF']);%20?%3E
            >
            so it looks to me like it's not parsing the action command
            correctly??? I have spent hours on this trying to find the problem and
            I cannot see any syntax errors here. Any suggestions out there?
            >

            --
            Rami.Elomaa@gma il.com
            "Olemme apinoiden planeetalla."

            Comment

            • Schraalhans Keukenmeester

              #7
              Re: problem with $_SERVER['REQUEST_METHOD '] == 'POST'

              Schraalhans Keukenmeester wrote:
              Schraalhans Keukenmeester wrote:
              >rynato@gmail.co m wrote:
              >>the problem is fixed. The weird part is, I had to manually re-key a
              >>few of the lines of code. Every time I re-keyed a line, char for char,
              >>the error shifted down one line. Finally I had re-keyed enough of the
              >>lines of code and it worked - to a point.
              >>>
              >>Now the problem is this:
              >>>
              >>the script runs fine. It's to upload an image and then resize it.
              >>>
              >>I have this line of code:
              >>>
              >>print "<form action=\"<?php print (\$_SERVER['PHP_SELF']); ?>\" method=
              >>\"post\" enctype=\"multi part/form-data\">\n";
              >>>
              >>when I browse locally to a photo, select it for upload, then submit
              >>it, I get a 404 error with the following path (I chopped off the
              >>unimportant first half of the URL):
              >>>
              >>/siteAdministrat ion/%3C?php%20print %20($_SERVER['PHP_SELF']);%20?%3E
              >>>
              >>so it looks to me like it's not parsing the action command
              >>correctly?? ? I have spent hours on this trying to find the problem and
              >>I cannot see any syntax errors here. Any suggestions out there?
              >>>
              >Your code is wrong. You start with some php code and then introduce new
              >php opening tags again. That would only make sense when it's part of an
              >otherwise pure html line.
              >>
              >You probably nee something like this instead:
              >>
              >print "<form action='$_SERVE R['PHP_SELF']' method='POST
              >enctype='multi part/form-data'>";
              >>
              >>
              add another single quote after POST. My bad.
              Geez, and brackets {} around $_SERVER['PHP_SELF']. Not my day apparantly...

              Comment

              Working...