ok - im running this site which has a small cms built in: for about 2 weeks now, variables that get submitted through forms using the POST method seem to not get passed on to the handling script. it works when i use GET, but some of the pages just transmit too much data for that. register globals is on. any ideas, what the serveradmin couldve changed there?

thanks a lot..
sid

    <?PHP
    
    print "<FORM ACTION=\"" . $PHP_SELF . "\" METHOD=\"post\" ENCTYPE=\"multipart/form-data\">
    <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\"lalala\">
    <INPUT  TYPE=\"submit\" VALUE=\"go sucker!\">
    </FORM>";
    
    if ($action) {
     print $action;
    }
    ?>
    

    output after submission: nothing

    <?PHP
    
    print "<FORM ACTION=\"" . $PHP_SELF . "\" METHOD=\"get\" ENCTYPE=\"multipart/form-data\">
    <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\"lalala\">
    <INPUT  TYPE=\"submit\" VALUE=\"go sucker!\">
    </FORM>";
    
    if ($action) {
     print $action;
    }
    ?>
    

    output after submission: "lalala"

      Have you tried checking the post array with a print_r($_POST), just to see if anything exists?

      Though, your form action should be giving you parse errors :p

      ACTION=\"" . $PHP_SELF"

        
        <?PHP 
        
        print "<FORM ACTION=\"$PHP_SELF\" METHOD=\"post\"> 
        <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\"lalala\"> 
        <INPUT  TYPE=\"submit\" VALUE=\"go sucker!\"> 
        </FORM>"; 
        
        if ($action) { 
         print $action; 
        } 
        ?> 
        
        OR USE
        
        <form action="<?php echo $PHP_SELF ?>" method="post">
        <input type="hidden" name="action" value="lalala">
        <input type="submit" value="go sucker!">
        
        <?
        if ($action) {
        print $action;
        }
        

        if it's not working, try changing this

        <? 
        $action = $_POST['action'];
        if($action != "") {
        print $action;
        }
        
        ?>
        

        to make sure that the variable is getting set, if its not, something is definately screwy..
        Is it possible to set globals on for Get and not Post?

          well i know you can make GET override POST........you might be able to do something like that.

            ok... first of all thanks for all your ideas and submissions so far...
            some news:

            a.) i fixed the \"" . $PHP_SELF . "\" in the former post ;-)

            b.) ive tried print_r($_POST); before - always returned an empty array

            c.) also $_POST('action') ive tried before - with an empty return value

            d.) <form action="<?php echo $PHP_SELF ?>" method="post"> shouldnt really change anything, since the html output of the form always was ok.

            now i found a new bit of info though:

            the values actually DO get set if i use POST as well as GET - also if i use GET with ENCTYPE="multipart/form-data" - but NOT if i use

            METHOD="post" ENCTYPE="multipart/form-data"

            • (mistake on my side) which i need though since the script includes a file upload feature.
              checking the php_info output also shows that

            file_uploads: no value / no value
            (should be file_uploads: on / on)

            so i suppose that this disables the functionality of ENCTYPE="multipart/form-data" forms completely? if so - thats kinda retarded, since it would be enough to just not allow an upload stream to be established... any knowledge on that issue out there?

              you could be running into a conflict with a variable named action and a form element that is action as well try renaming that to actionval or something.

                Originally posted by drawmack
                you could be running into a conflict with a variable named action and a form element that is action as well try renaming that to actionval or something.

                true... ive never experienced this before, but suppose you have a point there... still... as long as i stay away from the enctype attribute it works just fine. (and the script im testing with has additional fielts - still the $_POST array gets returned empty)

                  POST file data is sotred in $_FILES........ hth

                  moon

                    Write a Reply...