1

I have a problem, my form opens another PHP script with post method, but it doesn't pass on any values. I tried fixes such as setting in php.ini:

post_max_size = 8M
variables_order = "EGPCS"

and

Didn't work. Here's the form code:

<form enctype="text/plain" action="zalogujCheck.php" name="com-login" method="post" id="com-form-login">
                <label for="username">Nazwa użytkownika</label>
                <input name="username" id="username" type="text" class="inputbox input-long" alt="username" />
                <label for="passwd">Hasło</label>
                <input type="password" name="passwd" id="passwd" type="text" class="inputbox input-long" alt="password" />
            <input type="submit" value="Zatwierdź" name="submit">
        </form>

Here's the PHP for this form:

if( $_SERVER['REQUEST_METHOD'] === 'POST' )
  {
     echo "otwarte postem";
 print_r($_POST);
  }
echo "początek2";
if(isset($_POST["username"])){
    $USER=$_POST["username"];
    echo "ustawiłem username";
}
if(isset($_POST["passwd"])){
    $PASS=$_POST["passwd"];
    echo "ustawiłem passwd";
}
?>

Result is:

otwarte postemArray ( ) początek2

I am using XAMPP, don't know how much of an impact my choice has. Any help will be appreciated.

1
  • 1
    As a general troubleshooting rule, you should first use a browser addon like Firebug or Chrome's inbuilt dev features to see if you're actually sending POST variables. Commented Nov 5, 2013 at 11:11

1 Answer 1

4

Remove enctype="text/plain" from the <form> element.

The default is enctype="application/x-www-form-urlencoded", which is fine (so you don't need to specify it explicitly). Only if you have an <input type="file"> in your form, you should specify enctype="multipart/form-data" explicitly.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much, that's a copy-paste slap stick for me :). Don't know form too well yet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.