PDA

View Full Version : مشکل با متد post



mahtab13
پنج شنبه 22 تیر 1396, 22:57 عصر
سلام وقت بخیر
بنده یه پروژه ایجاد کرده اطلاعات را با متد post برای صفحه check ارسال کردم و نتیجه رو با متد post برمی گردونم اما کاری انجام نمیده وقتی همه رو تبدیل متد get می کنم اجرا میشه
لطفا منو راهنمایی کنید
check .php
<?php
session_start();
if(isset($_POST["btn"]))
{
if(empty($_POST["txtname"]) || empty($_POST["txtpass"]))
{
header("location:index.php?empty=1010");
exit;
}
else
if(strlen($_POST["textname"])<4 && strlen($_POST["txtpass"])<4)
{
header("location:index.php?small=2020");
exit;
}
else
if($_POST["txtname"]=="2020" && $_POST["txtpass"]=="1111")
{
$_SESSION["x"]=1;
header("location:panel.php");
exit;

}
else
{
header("location:index.php?error=3030");
exit;
}
}
else
{
header("location:index.php");
exit;
}
?>
صفحه index.php



<html>
<head>
<meta charset="utf-8">
<title>my page</title>
<style type="text/css" rel="stylesheet">
#name{
margin-top: 50px;
margin-left: 30px;
}
#pass
{
margin-left: 30px;
}
</style>
</head>
<body>
<?php
if(isset($_GET["empty"]))
{
echo "<font color=#f00 size=5px><center>"."یکی از کادرها خالی می باشد"." </center></font>";
}
if(isset($_GET["small"]))
{
echo "<font color=#00f size=5px><center>"."طول کارکترها کمتر از مقدار استاندارد می باشد "."</font></center>";
}
if(isset($_GET["error"]))
{
echo "<font color=#f0a size=5px><center>"."نام کاربری و یا رمز عبور اشتباه است "."</font></center>";
}

?>
<form action="check.php" method="post">
<center>
<p>user name:<input type="text" name="txtname" id="name"> </p>

<p>password:<input type="password" name="txtpass" id="pass"></p>
<br>

<input type="submit" name="btn" value="OK">

</center>
</form>
</body>
</html>