PHP上传-为什么isset($ _ POST ['submit'])始终为FALSE [英] PHP upload - Why isset($_POST['submit']) is always FALSE

查看:231
本文介绍了PHP上传-为什么isset($ _ POST ['submit'])始终为FALSE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码示例upload3.php:

I have the following code sample upload3.php:

<html>
<head>
<title>PHP Form Upload</title>
</head>
<body>

<form method='post' action='upload3.php' enctype='multipart/form-data'>
    Select a File:
    <input type='file' name='filename' size='10' />
    <input type='submit' value='Upload' />
</form>

<?php

if (isset($_POST['submit']))
{
    echo "isset submit";
}
else 
{
    echo "NOT isset submit";
}

?>

</body>
</html>

代码始终返回"NOT isset Submit". 为什么会这样?因为相同的脚本upload3.php会自己调用?

The code always returns "NOT isset submit". Why does this happen? Because the same script upload3.php calls itself?

推荐答案

您没有名为"
"的提交按钮. 更改

You do not have your submit button named:
Change

<input type='submit' value='Upload' />

收件人:

<input type='submit' value='Upload' name="submit"/>

这篇关于PHP上传-为什么isset($ _ POST ['submit'])始终为FALSE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆