Reputation: 165
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.
Upvotes: 1
Views: 1027
Reputation: 31647
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.
Upvotes: 4