action in same page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tripathisanjiv
    New Member
    • Mar 2007
    • 1

    action in same page

    i want know if i am giving the action in same page. then what the file name in action. Something one word "PHP-SELF". I am not conformed and i have used but error is showing something access forbidden and error no. 403. If anybody know very well please inform to right suggestion. thanks.
  • DeMan
    Top Contributor
    • Nov 2006
    • 1799

    #2
    Someone in one of the web-related technologies on the Right Hand Side of the page may be able to help you (I'd try the PHP group first, I think)

    Comment

    • MMcCarthy
      Recognized Expert MVP
      • Aug 2006
      • 14387

      #3
      Originally posted by DeMan
      Someone in one of the web-related technologies on the Right Hand Side of the page may be able to help you (I'd try the PHP group first, I think)
      This question is being moved to the PHP forum.

      ADMIN

      Comment

      • ak1dnar
        Recognized Expert Top Contributor
        • Jan 2007
        • 1584

        #4
        Why don't you submit your coding here.
        Normally You can set the action property like this:

        [PHP]echo '<form action="'.$PHP_ SELF.'" method="POST">' ;[/PHP]
        This form will print by PHP, so i can't guess about your Form..

        Comment

        • devsusen
          New Member
          • Feb 2007
          • 136

          #5
          Hi,

          I think this should work $_SERVER['PHP_SELF'] instead of $PHP_SELF.

          Comment

          • ak1dnar
            Recognized Expert Top Contributor
            • Jan 2007
            • 1584

            #6
            Originally posted by devsusen
            Hi,

            I think this should work $_SERVER['PHP_SELF'] instead of $PHP_SELF.

            Try this by your self by putting this in a single .php page.

            [PHP]<?php
            echo '<form name="PHP" action="'.$PHP_ SELF.'" method="POST">' ;
            echo '<input type="submit" name="click_php " value="PHP form" />';
            echo '</form>';
            if($_POST['click_php'])
            {
            echo 'This is from PHP form';
            }

            ?>
            <HTML>
            <body>
            <form name = "HTML" action="<? $_SERVER['PHP_SELF'] ?>" method="POST">
            <input type="submit" name="click_htm l" value="HTML form" />
            </form>
            </body>
            </HTML>
            <?
            if($_POST['click_html'])
            {
            echo 'This from HTML form';
            }
            ?>[/PHP]

            Comment

            • devsusen
              New Member
              • Feb 2007
              • 136

              #7
              Hi,

              From PHP 4.2.0 onwords directive register_global s went off. $PHP_SELF will ONLY exist if register_global s is on. So its always better to use $_SERVER['PHP_SELF'] or $HTTP_SERVER_VA RS['PHP_SELF']. I prefer to use $_SERVER['PHP_SELF'].

              susen

              Comment

              Working...