<?phpprint_r($_POST);
?> <form action="a.php" method="post" enctype="text/plain"> <input type="text" name="user" value="" size="40" maxlength="40"/> <input type="submit" name="name" value="submit"/>
</form>在输入框中输入信息,如“aaa”,点击"submit"按钮,却发现$_POST变量为空数组,不是应该返回一个有两个元素的数组吗?
?> <form action="a.php" method="post" enctype="text/plain"> <input type="text" name="user" value="" size="40" maxlength="40"/> <input type="submit" name="name" value="submit"/>
</form>在输入框中输入信息,如“aaa”,点击"submit"按钮,却发现$_POST变量为空数组,不是应该返回一个有两个元素的数组吗?
<form id="form1" name="form1" method="post" action="xxx.php">
其他的时候很少用到·!
<?php
$act=$_GET['act'];
if($act=='add')
{
$user_name=$_POST['user'];
echo $user_name;
}
?> <form action="?act=add" method="post" name="form1"> <input type="text" name="user" value="" size="40" maxlength="40"/> <input type="submit" name="name" value="submit"/>
</form>
$act=$_GET['act'];
if($act=='add')
{
$user_name=$_POST['user'];
echo $user_name;
}
?> <form action="?act=add" method="post" name="form1"> <input type="text" name="user" value="" size="40" maxlength="40"/> <input type="submit" name="name" value="submit"/>
</form>
用 Enctype 属性指定将数据回发到服务器时浏览器使用的编码类型。
application/x-www-form-urlencoded: 窗体数据被编码为名称/值对。这是标准的编码格式。
multipart/form-data: 窗体数据被编码为一条消息,页上的每个控件对应消息中的一个部分,上传附件用到
text/plain: 窗体数据以纯文本形式进行编码,其中不含任何控件或格式字符。
enctype="multipart/form-data是设置表单的MIME编码。默认情况,这个编码格式是application/x-www-form-urlencoded,不能用于文件上传;只有使用了multipart/form-data,才能完整的传递文件数据,进行下面的操作.
我就曾经纠结了好久……
吧wamp整个删除了,然后重装,
?> <form action="<?=$_SERVER['PHP_SELF']?>" method="post""> <input type="text" name="user" value="" size="40" maxlength="40"/> <input type="submit" name="name" value="submit"/>
</form>
<form id="form1" name="form1" method="post" action="xxx.php">